What is wrong with this code?!


#1


https://www.codecademy.com/courses/javascript-beginner-en-ASGIv/1/1?curriculum_id=506324b3a7dffd00020bf661#


Oops, try again. There was a problem with your syntax. That's all I am getting and I am not sure why. I've troubleshooted, yet I can't Find what is wrong with this code!


//Remember to set your condition outside the loop!

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


#2

a while loop only has a condition, you seem to have mixed up for:

for (i = 0; i < 20; i++)

and while loop:

while(i<20)

#3

Bro, you mixed up between 'for' loop and 'while' loop.

The code should be likw this;

//Remember to set your condition outside the loop!
var count=0;
var loop = function() {
while(count<3) {
console.log("I'm looping!");
count++;
}
};
loop(false);
If you find useful then don't forget to like it.


#4

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