Skip to content

Instantly share code, notes, and snippets.

@kidroca
Last active February 6, 2019 22:02
Show Gist options
  • Save kidroca/8e6e2506b1f586c27b97c5219ee2a7ad to your computer and use it in GitHub Desktop.
Save kidroca/8e6e2506b1f586c27b97c5219ee2a7ad to your computer and use it in GitHub Desktop.
My Fizz buzz JavaScript solution
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