Nth Fibonacci

function getNthFib(n) {
return fibRecursion(n);
}
function fibRecursion(n) {
if (n === 2) {
return 1;
}
if (n === 1) {
return 0;
}
const sum = fibRecursion(n - 1) + fibRecursion(n - 2);
return sum;
}
// Do not edit the line below.
exports.getNthFib = getNthFib;Last updated