Site crashing on this course (HELP)


#1

I am stuck on this part of the course, not because the code is wrong, because every time I submit to carry on the site crashes. Its really only this course, I have had problems with other courses, but they eventually worked.

I have good PC specs, so I don't believe it is that.

If you have had this issue and know how to sort it, then please let me know.

Thanks.


#2

Are you sure it's not because you creating infinite loops?


#3

you can have a super computer, an infinity loop will still crash it.

Please post your code, it is very likely you have an infinity loop, the only way we can fix an infinity loop is by looking at your code and tell you what is wrong


#4

You may be correct, here is the code anyway, just changed a few things and the site didn't crash, so, maybe it was an infinite loop

         for (var i = 5; i < 50; i + 5) {
         console.log(i);
        }

#5

this is wrong, it should be i += 5 or i = i + 5 because you're adding 5 to I, but you're not changing the variable to have 5 more each time.
I don't know that this makes sense, it seems vague, but someone else may be able to explain better.


#6

Yeah, thanks.

Was forever wondering why it kept crashing.

Thanks for your help.


#7

look at this code:

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

i always find this perfectly illustrate the problem. you can temporary at 5 to a variable (just to log it, or for whatever reason) or you can update the variable

In a loop, you need to update the variable, otherwise i will remain 10 (i + 5), since i will not increase, the condition will never evaluate to false, the loop becomes infinite and crashes your browser


#8

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