Skip to content

Instantly share code, notes, and snippets.

@mateusmlo
Last active February 25, 2019 19:40
Show Gist options
  • Select an option

  • Save mateusmlo/db7dca46b2418a3eee85488f73a87248 to your computer and use it in GitHub Desktop.

Select an option

Save mateusmlo/db7dca46b2418a3eee85488f73a87248 to your computer and use it in GitHub Desktop.
FizzBuzz problem with JS
const checkFizzBuzz = n => {
if (n % 3 === 0 && n % 5 === 0) return 'Fizz Buzz';
if (n % 3 === 0) return 'Fizz';
if (n % 5 === 0) return 'Buzz';
return n;
}
const oneToHundred = [...Array(101).keys()].slice(1);
const getFizzBuzz = oneToHundred.map(checkFizzBuzz);
@mateusmlo
Copy link
Author

GHub keeps my code with this ridiculous tab size (even though I use spaces) and won't let me change it! :rage2:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment