What is wrong


#1

I don"t know what's wrong (While Loops, Lesson 5 )
And also can someone explain this 'cause usually I have trouble understanding Javascript

var count = 0

var loop = function(){
while (count < 3){
count++ console.log("I'm looping!")
}
loop();
}
(it says I have a syntax error)


#2

You have a couple of things wrong there. First let's sort out your syntax error. In real life, you will be using an editor that helps you spot syntax errors. Let's put your code into an editor that will show you where the problem is.

https://repl.it/DQFo

Hover over the X to read about the problem. Can you see how to fix the syntax error now?


#3

What did I exactly do wrong (I changed my error)


#4

It says i am wrong still ? error says are you logging "I'm looping" to the console 3 times codecademy won't except it


#5

Problem 1: Try to rewrite line 4.
Problem 2: You are not calling your function properly.


#6

Is this better

var count = 0

var loop = function(){
while (count < 3){
count++; console.log("I'm looping");
}
loop();
};
please correct me if I am wrong


#7

I don't know what you mean by calling a function

P.S I think I am bad at javascript ):


#8

Yes you solved the Problem # 1

Now try to figure out the Problem # 2

Hint:

Creating a Function
var myFunction = function(){
// Statements
}

Calling a Function
myFunction();


#9

Don't worry, we all were brand new at this at one point. Just take it one step at a time and ask questions when things aren't clear.


#10

Thanks sometimes I really doubt myself if I get something wrong


#11

YES I moved loop() to the end and put a semicolon thank you both !!!!!!!


#12

It might not make you feel better, but this is the very, early beginner stages of coding. Imagine showing a young child the A B Cs and they get frustrated and say they are bad at it and will never learn to read. Of course they are going to get frustrated at times but you already know that they should keep at it to get to the good stuff! :slight_smile:


#13

Thanks I really appreciate it
also now I have repl.it to use when i have trouble


#14

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