I’m working on the Sum All Odd Fibonacci Numbers challenge and running into an issue.
In the FCC challenge, when I try to specify the loop duration as i<=num
I get an unresponsive script error. If I run the same code in the browser console, it works fine. If I sub in a hard-coded value (i<=4
) it works in FCC.
function getFibs(num) {
var fibs = [];
fibs[0] = 0;
fibs[1] = 1;
for (var i=2; i<=num; i++) {
fibs[i] = fibs[i-2] + fibs[i-1];
}
return fibs;
}
sumFibs(4);
Anyone have an idea of what’s going on here?