Totally Lost on While Loops Variables


#1

Hi, here is what I tried and is not working:

count = 0;

var loop = function(count++){
while(count < 3){
console.log(count);

}

};

loop();

What am I missing? Thanks again...


#2

Hi your function should not have a argument so here

var loop = function(count++)

Remove the count++

And inside your while loop you should add count++ like that

while(count < 3){
console.log(count);
    count++
}

And read this on how to format your code

https://discuss.codecademy.com/t/how-do-i-format-code-in-my-posts/28351


#3

Thanks once again! Worked right away.


#4

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