Stuck on my code #5


#1



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


I should create my personal while loop. but somehow I think I didnt quite get it. Therefore my code is somehow not complete... I should add a way, how the var "count" adds up, but somehow I dont know where to put it.

I tried putting it into the parantheses of the while condition: while(count<3; count++) but this results in "SyntaxError: unexpectet token"...

I should also have a third way to print out code into the console... but cant think of any.


var count = 0;

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

loop();


#2

You should increment count inside your while-statement.
And also, the return statement exits the loop. (remove those)


#3

You could do this rather!

console.log("I'm looping!"); count++;

#4

thank you so much! the first part is solved then :slight_smile: now my problem is, I mustnt use console.log more then once...


#5

lol got it ^^ im sorted, just misunderstood the instructions XD


#6

You're welcome.

Have fun coding! :slight_smile:


#7

Was very confused about this step. Thanks for the clear instructions!


#8

You're welcome.

Have fun coding! :smile:


#9

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