Count++ syntax issue


I'm getting a syntax issue? Something I'm missing, just can't see it.

while count = 0

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



your 2 counts are two different variables that share their name but nothing else, so the one outside is 0 and the one inside is undefined due to a lack of a value here: loop();

Also the while here:

while count = 0

should be a var. So get rid of this line and use loop(0) instead.


That worked, thanks.


Hi, I have the same problem. Can you help me please?


Open a new thread with your code and the error message you get. The code snippets are rather short so it often happens that there are common error messages and similar codes but if what is written here doesn't solve your problem it might be something else and it would be better if you open your own thread.