How to Calculate the Nth Fibonacci Number

Jon Randy 🎖️ - Apr 3 - - Dev Community

Okay, lets dive straight into the code...

const fib = n =>
  Math.floor((((1 + 5**.5)/2)**n - ((1 - 5**.5)/2)**n)/5**.5)
Enter fullscreen mode Exit fullscreen mode

Explanation here.

. . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player