While loops => stucked here


#1

var understand = true;

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

#2

What's the problem with this?
Could you add the exercise?
Maybe a specific output message is required?

So far it is a working while loop so the syntax is not your problem.
Or are you concerned about the additional false at the end? That is just an echo of the last value in your code

understand = false;

Nothing to worry about it doesn't mean that your code is false but is really just an echo.


#3

I'm stuck there too! I've got the exact same code, and the page becomes unresponsive when I run the code. It shouldn't start an infinite loop, as in the code block, we assign the false value to it. That would mean when it goes to execute the code again, it would check the condition understand === true. As understand != true, the while loop should end, meaning the console should log "I'm learning while loops!" once.

-Never mind I left Chrome and did the exercise on Firefox that fixed the problem for me.


#5

I am also stuck there


#6

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