2. while syntax


var understand = true;

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

what it does not work?
instructions: Try it yourself—complete the while loop in the editor so it will print out "I'm learning while loops!". Do this by adding the condition between the parentheses—don't change line 5, or you could get an infinite loop!


while(understand = 0){

we use = for assigment if we want to compare two value then we shoud use == or ===

so your while loop should be like
while(understand == true){
while(understand === true){

we use 0 for false and 1 for true


thanks rcodeman....fixed


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