Skip to content

Instantly share code, notes, and snippets.

@jkantr
Last active March 1, 2019 02:55
Show Gist options
  • Save jkantr/1b4abdd7be12fcbc9c5a30f283c99bbc to your computer and use it in GitHub Desktop.
Save jkantr/1b4abdd7be12fcbc9c5a30f283c99bbc to your computer and use it in GitHub Desktop.
"Functional" Javascript FizzBuzz solution
Array.from({ length: 100 }, (v, i) => [[15, 'fizzbuzz'], [5, 'buzz'], [3, 'fizz']].find(x => (i+1) % x[0] === 0) || (i + 1))
  .reduce((a, o) => a += (o[1] || o) + "\n",'')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment