JS : While exercise 2


#1

var understand = true;

while( understand = true ){
understand("learning while !");
understand = false;
}

why doesn't it work?
during the first loop, understand should become false and put an end to the program but for some reason it crash.


#2

because inside while the comparison is wrong

you should use while (understand == true)


#3

thanks, it works now


#4

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