Can't Save and Submit Code


#1

On some of the activities, when I hit Save and Submit Code, the page freezes and when I kill the page, I find that the code isn't submitted. This happens on activities 2, 3, 5 and 11. I wasn't sure where to go for troubleshooting, so that's why I'm posting this here. Sorry if it's in the wrong spot.


#2

You most likely have an infinite loop. Please post your code. :slight_smile:


#3

Does refreshing help? This used to happen to me in the Ruby track.

On the other hand... You can also experience this behavior if you've created some infinite loops. They are pesky little things :imp:


#4

Refreshing doesn't help, it just gives me the option to kill the page. as for my code, here's the code for the second activity:

var understand = true;

while(understand = true){
console.log("I'm learning while loops!");
understand = false;
}


#5

@enderfire, I don't know if it will cause an infinite loop but in your while condition you are assigning the true value to understand rather than testing the condition. Perhaps this results in a while loop that cannot end because nothing is being tested.


#6

it will :slight_smile:

an assignment has the value you assign so in this case the expression understand = true has a value of true which is the classical infinite loop:

while(true){

}

#7

Good to know, thank you for confirming, @haxor789! I wondered if the understand = false; would stop it, but after seeing your answer I realize that the while checking "condition" is sure to always reset itself to keep going; is that right?


#8

Yes understand = true overwrites whatever was the value of understand so the understand = false; doesn't help here, but is obviously necessary if == was used.