Last active
February 6, 2019 22:02
-
-
Save kidroca/8e6e2506b1f586c27b97c5219ee2a7ad to your computer and use it in GitHub Desktop.
My Fizz buzz JavaScript solution
This file contains hidden or 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
new Array(100).fill(1) | |
.map((_, i) => { | |
const current = i + 1; | |
let text = ''; | |
if (current % 3 === 0) text += 'Fizz'; | |
if (current % 5 === 0) text += 'Buzz'; | |
return text || current; | |
}) | |
.forEach(i => console.log(i)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment