How is this an infinite loop?!?!

My code is causing my browser to crash. :confused: 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;


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

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. :confused: so it prints out the array on your computer? It works fine?

You can see itโ€™s printing Array at the end.

Have you tried resetting the code in your account?