Skip to content

Instantly share code, notes, and snippets.

@denysonique
Created October 11, 2013 16:26
Show Gist options
  • Save denysonique/6937791 to your computer and use it in GitHub Desktop.
Save denysonique/6937791 to your computer and use it in GitHub Desktop.
function fibonacci(n, cb) {
console.log(n)
if (n < 2)
cb(1);
else
fibonacci(n-2, function(wynik) {
fibonacci(n-1, function(wynik2) {
cb(wynik + wynik2)
})
})
}
fibonacci(20, console.log)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment