What's wrong with my code? while loop, Math.random



The while loop just doesn't work. I don't know what's wrong with the syntax, I'm not able to find out how to use the condition variable.

var condition = Math.floor(Math.random());

while (condition === 1) {
    condition = Math.floor(Math.random());


i think you should change the condition in while loop " condition = Math.floor(Math.random());"
because we put that condition there for stop the while loop. but you are put the same condition in starting also. it should not be!


I don't understand that. So I should put the var into the loop or not?


put var inside the condition


put var inside condition of while loop


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