While Loop brevity


#1


Introduction to 'While' Loops in JS - Review

My console.log message doesn't appear. In my code below, I thought my variable "times" is set to 0 then the console.log message appears then "times" is set to 1. Instead the console.log message never appears. More interesting is that it works if I set "while(times===0)" instead of just "while(times)". I thought that for brevity, I could omit the "===" but why does it not work without it.


var times=0

var plainLoop=function(){
    while(times){
        console.log("Last time I'm repeating this simple loop!")
        times++
    }
};

plainLoop();


#2

@seitys,
You will have to use a different WHILE condition...
like

(times === 0)

#3

maybe cause it is a counter not a true false? Your 0 means zero not True right? not a boolean.
I think..