Created
June 20, 2017 22:15
-
-
Save noroot/dff42ee0e110a67ef3a0e3adb7a0456c to your computer and use it in GitHub Desktop.
Javascript Fibonacci sequence example
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
var f = function () { | |
let p = 0, n = 1,t; | |
return function () { | |
t = p; | |
p = n; | |
n += t; | |
return t; | |
}; | |
} | |
let fr = f(); | |
for (let i = 0; i<=10;i++) { | |
console.log(fr()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment