-
-
Save cpebble/4f34d9f2f8caeefbffe82e77f26cf44b to your computer and use it in GitHub Desktop.
Fizzbuzz but can i do FP? no u
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iota (n) { // Pretty genius implementation | |
return [...Array(n).keys()] | |
} | |
function fizzbuzz (n) { | |
return iota(30).map( x => | |
(x % 15 === 0 ? "fizzbuzz" : x % 3 == 0 ? "fizz" : x % 5 == 0 ? "buzz" : x.toString()) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment