Skip to content

Instantly share code, notes, and snippets.

@justincorrigible
Last active December 5, 2015 19:26
Show Gist options
  • Save justincorrigible/aa9cc837d6eb764d6116 to your computer and use it in GitHub Desktop.
Save justincorrigible/aa9cc837d6eb764d6116 to your computer and use it in GitHub Desktop.
A quick and dirty FizzBuzz attempt... just in case I ever need it.
var fzbz = Array .apply(null, { length: 101 })
.map(Number.call, Number)
.map(obj => obj % 3 === 0 && obj % 5 === 0 ?
'fizzbuzz' : obj % 3 === 0 ?
'fizz' : obj % 5 === 0 ?
'buzz' : obj);
fzbz.shift();
@justincorrigible
Copy link
Author

"Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."

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