Practice makes perfect -help plz


#1

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

why there var count = 0 ? if it 1 its not working . give me some explanation plz.

var count = 0

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

loop();

#2

The question states "Write a while loop that logs "I'm looping!" to the console three times."
If you made count start at 1 it would loop 2 times as it doesn't go higher than 3 because of this code.

Let me know if you need further explanation.


#3

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