Skip to content

Instantly share code, notes, and snippets.

@vstarck
Created October 4, 2012 19:34
Show Gist options
  • Save vstarck/3835879 to your computer and use it in GitHub Desktop.
Save vstarck/3835879 to your computer and use it in GitHub Desktop.
FizzBuzz
var m = [
function(i, memo) { return i%5 ? memo : memo + 'Fizz' },
function(i, memo) { return i%3 ? memo : memo + 'Buzz' },
function(i, memo) { return memo || i }
]
for(var i = 1; i < 100; i++) {
console.log(m.reduce(function(memo, current) {
return current(i, memo);
}, ''));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment