What am I doing wrong?


#1

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

Syntax problems, mainly. It doesn't recognise the '++' symbols


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

var loop = function(count < 3){
	while(count){
		console.log(I'm Looping')
	}
};

loop(count++);


#2

You have defined count globally. Your function will work on this variable, you don't have to pass any values to the function.

var loop = function(){

while(count), this condition is not correct. You want to loop as long as count is smaller than some number, right?


console.log(I'm Looping')

You want to print out to the console a string. String should be enclosed in quotation marks.


loop(count++);

Your function should not take any parameters, so it should be loop(). You still have to change value of count, but inside the loop.


#3

var count = 0

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


#4

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