Skip to content

Instantly share code, notes, and snippets.

@jshcrowthe
Created May 14, 2015 01:58
Show Gist options
  • Save jshcrowthe/cda7b0c7628d42786645 to your computer and use it in GitHub Desktop.
Save jshcrowthe/cda7b0c7628d42786645 to your computer and use it in GitHub Desktop.
Fibonacci Sequence (The cool way)
var fibonacci = function(n) {
return Array.apply(null, Array(n))
.reduce(function(sequence, value, index) {
return sequence.concat((index < 2) ? index : sequence[index - 1] + sequence[index - 2]);
}, []);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment