Created
November 5, 2015 22:55
-
-
Save josephjunker/e55c24071d3da6e94d47 to your computer and use it in GitHub Desktop.
I learned a new feature of JS today
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
function fib() { if(!x()) return z(); return fib(x(), y(), z()); } | |
function x() { return fib.arguments[0] - 1; } | |
function y() { return fib.arguments[2] || 0; } | |
function z() { return (fib.arguments[1] || 0) + (fib.arguments[2] || 1); } | |
[fib(1), fib(2), fib(3), fib(4), fib(5), fib(6)].join(); // returns '1,1,2,3,5,8' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment