Fibonacci sequence algorithm in Javascript

How about using smarter recursion?

function fib(a, b, n) { if(n) return fib(b, a + b, n — 1); else return a }

fib(0, 1, 50)

Like what you read? Give Victor Moroz a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.