What is wrong


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!")
(it says I have a syntax error)


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.


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


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


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


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


Is this better

var count = 0

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


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

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


Yes you solved the Problem # 1

Now try to figure out the Problem # 2


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

Calling a Function


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.


Thanks sometimes I really doubt myself if I get something wrong


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


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:


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


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