How do you find the nth Fibonacci number recursion JS code example
Example: how to get nth fibonacci javascript
function nthFib(n) {
if(n <= 2) return n -1;
return nthFib(n - 2) + nthFib(n - 1);
}
function nthFib(n) {
if(n <= 2) return n -1;
return nthFib(n - 2) + nthFib(n - 1);
}