Why my browser crashed? simple "DO WHILE"


#1

Why my code causes my browser crashed :anguished:
I think the code will print "aloaloaloalo" to the console because the condition m=2 is false. As a result, it will do the "do" statement.

var m=1;
var getToDaChoppa = function(){
    do {
        console.log("aloaloaloalo")
    } while (m=2)
};

getToDaChoppa();

#2

The = sign is an assignment operator. For conditions, you want to use the === comparison operator.


#3

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