Created
January 15, 2018 23:54
-
-
Save m93a/f44646d2d388307387d158fac057178c to your computer and use it in GitHub Desktop.
Yet another Fibonacci
This file contains 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(){ | |
window.fibonacci = function(){ | |
var n = new Number(1); | |
n.next = next; | |
return n; | |
}; | |
function next(){ | |
var n = new Number( this + (this.prev||0) ); | |
n.prev = +this; | |
n.next = next; | |
return n; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment