My code is causing my browser to crash. can someone tell me why?
function sumFibs(num) {
var allFibs = [1,1];
for (var i = 1; i <= num; i++) {
allFibs.push(allFibs[i] + allFibs[i - 1]);
}
return allFibs;
}
sumFibs(4);
My code is causing my browser to crash. can someone tell me why?
function sumFibs(num) {
var allFibs = [1,1];
for (var i = 1; i <= num; i++) {
allFibs.push(allFibs[i] + allFibs[i - 1]);
}
return allFibs;
}
sumFibs(4);
In my Google chrome console your function is working fine. Have you tried another browser as well? Sometimes FCC get stuck may be because of cookies.
You may also see this link if this is the problem https://github.com/freecodecamp/freecodecamp/wiki/FreeCodeCamp-Disable-Code-Autorun
quick note:
you donโt want to push 4 new values, you want to push values that are smaller or equal to 4 in this case
I cleared the cookies, logged into FCC again, and ran the code again on chrome and safari and it caused both to crash. so it prints out the array on your computer? It works fine?
Have you tried resetting the code in your account?