Last active
May 11, 2019 12:16
-
-
Save thakursaurabh1998/432c8a78a2a173023767caead4400b8b to your computer and use it in GitHub Desktop.
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 fib() { | |
let a = 0; | |
let b = 1; | |
let c = 0; | |
return function() { | |
a = b; | |
b = c; | |
c = a + b; | |
return b; | |
} | |
} | |
const f = fib(); | |
for (let i = 0; i < 20; i++) { | |
console.log(f()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment