Crashing my browser


Replace this line with your code.


What is the name of the exercise?


Sounds like you've created an infinite loop. If you had replaced that line with your code we could be talking about how to fix that.


Intro to While Loop I added a condition as instructed and my browser crashed


And why was my account placed on hold?


It's automated. It's just automated along with your fist post


Let's see your condition -- let's see all of your code.


ahh ok so why an excercise that results in an infinite loop?


If you created a loop that has no way to end itself then you have an infinite loop.


yes I see that, but any condition in that code block will result in an infinite loop


How do you figure that? -- give me an example.

I'm not sure which code block you are referring to here.


well if you enter a condition that is true the excercise runs as an infinite loop such as 5+5===10. If you run 5+5=11 the exercise fails


the only solution is to simply add the variable to the condition, which really does little to help understand how a while loop works


Is this the exercise we are talking about?


yes that is the exercise I'm referring to


Funny thing is the very next exercise actually touches on that, and explains that the condition must change. Kind of putting the cart before the horse, just saying


If you are going to loop as long as that is true -- which is forever, then it makes sense that you would have created an infinite loop.

I think the creator of the exercise was hoping that you would use the understand variable that they have setup there for you.

You don't have to do that though, but you can not just put in a condition that will always be true.

You could put in something like i < 10, then you would have to set the variable before the loop starts and then inside the loop you would have to change its value so that eventually the condition was no longer true.

For one of an infinite number of possibilities:

var i = 0;
while( i < 10 ){
    console.log("I'm learning while loops!");


That happens sometimes :wink:


Yes but that is essentially a for loop correct? I suppose I just got confused with the instructions.


You could accomplish the same thing with a for loop, yes. That wasn't what you started out asking about though.

any condition in that code block will result in an infinite loop

is what you were wondering about. If you need an example that is less like a for loop:

var playAgain = "yes";
while( playAgain === "yes" ){
    console.log("I'm learning while loops!");
    playAgain = prompt("Do you want to play again?");

The point is, that there are infinite conditions that you could write that would not cause an infinite loop.