JS : While exercise 2


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.


because inside while the comparison is wrong

you should use while (understand == true)


thanks, it works now


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