What is wrong with this code?!



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!"); 


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

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

and while loop:



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!");
If you find useful then don't forget to like it.


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