While syntax


I'm having an issue with this.

var understand = true;

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

The instructions are to make a while loop
understand = false.

No matter what I put in I either get an error or an infinite loop.


You assigned understand to false, but here should be condition that returns true. It's can be:

while( understand ) { ... }
while( understand === true ) { ... }


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