5. Practic Makes Perfect ........ yeeeeeeh I'm stuck again xD


#1

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

//Remember to set your condition outside the loop!
var count = 0

var loop = function(){
	while(count < 3) {
		//Your code goes here!
		console.log("I'm looping");
		count = false
	}
};

loop()

`


#2

Your problem is here. If we look at the hint we can see, "If we create a variable called count and set it to 0 outside the loop (on line 2), then do count++ each time we console.log() inside the loop, we'll be able to track how many loops we've made. If we set the while condition to be count < 3, that should do the trick!" Try using count++ instead of count = false.


#3

Thx man yeh it worked perfectly <3


#4

Good! Glad to have helped and happy coding! :smiley:


#5

sorry it's been a couple of months since I picked up where I left off at on this site still you said count++ instead of false I put that in and see that it repeated the console log count another two times thus repeating it 3 times. Still how exactly does the program know to cancels it out at this point or to exit the loop is it because we have given it a set number to reach another 2 more ? which causes it to end there and exit the loop?


#6

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