While loops error message


#1

This code doesn´t work. Please, could you help-me ? Thank you

var count = 0;


var loop = function (displayMsg) {
	while(count<3){
	console.log(displayMsg);
	count++;
	
	//Your code goes here!
	}
};

loop ("I´m looping");

The error message is:
Ops, tente outra vez. It looks like you're not printing the right string to the console.


#2

@flavioibr

Can we get the link for the exercise? Thanks.


#3

Hi flavioibr :slight_smile:

The problem's that you are using "I´m looping" instead of "I'm looping!" (note the difference carefully)

P.S. Your count variable should be declared inside the function, so that it begins from zero every time you call it. Right now it is global so it would work for only one call because after that it would be 3 and the condition thus false.