Introduction to while loops! its not working for me!


#1



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


var count=0
var loop = function(count++){
	while(count < 3){
	    console.log("Im loopimg!")
	}
};

loop();


#2

The problem is that your loop is infinite.

Yes, you did try to say make count increase by one every time that the loop is run, but you passed it in as an argument to your function. This means that the loop isn't going to know when to stop. You need to find a new place to stick it (I'll leave that up to you :slight_smile: ).

One little side note: look for little bugs in your program, and see if you might have missed anything.


#3

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