While loops


#1

HELP!! What is wrong with this code? Why won't it loop three times?

var count=0;
var loop = function(){
while(count<3, count++){
console.log("I'm looping");
}

};

loop();


#2

It should look like this, your setup is improper syntax.

var count = 0;
var loop = function(){
    while(count < 3){
         console.log("I'm looping");
         count++;
    }
};
loop();

#3

Thanks for your input. It worked!! :slightly_smiling: