Tab freezing bug


Whenever I hit "Save & Submit Code" during this exercise the tab freezes and becomes completely unresponsive. I've tried using three different computers and a second search engine (I've tried Firefox & Chrome), but the problem persists. Any help would be appreciated.


sounds like an infinity loop, can you copy paste your code to the forum? The url will just load the exercise with my own code


for (var i = 5; i < 51; i + 5) {


infinity loop, like i guessed. Look at this code:

var i = 5
console.log(i) // 5
console.log(i + 5)// 10
console.log(i) // 5
i = i + 5
console.log(i)// 10

in your code, you never update i, you just temporary add 5, but that is it.


Okay, thanks.
I'll just go back and make sure it updates the value.


Hi! could you explain please? I mean the code from previous lesson works okay.. and whatre #s?


i mess up languages, in python there are comments :stuck_out_tongue: i changed them // which are JS comments. It just give the output, so you can just look at the code without running it


Thanks! love codeCademy :+1: but why another task didn`t make infinity loop?


well, its not the tasks which makes infinity loops, its your code

A small mistake is easily made, difficult to tell


I meant this:

why it didn`t make infinity loop?


well, the loop condition becomes false after a couple of iterations, so its not a infinity loop

the big difference is here:

i = i + 1
i + 1

you update i correctly so it becomes 24 eventually and the loop ends.

the second code (i added) will just temporary add 1 to i, the i variable never updates. Which i demonstrated with the print statements


Thanks, such a silly mistake))


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.