Why is this wrong?


#1

Can someone tell me why this is wrong?


Thanks!


#2

this is the syntax of a else/if statement

if (condition) {
    block of code to be executed if the condition is true
} else { 
    block of code to be executed if the condition is false
}

You are almost there. Remove the if from line 6 and get your curly brackets in order (the syntax example).


#3

if ("myname".length <= 1) {
  console.log("Let's go down the first road!");
}
else
if ("myname".length >= 1) 
    console.log("Fun ");
}
{
    // What should we do if the condition is false?  Fill in here:

}

¦¦
¦¦
V

if ("myname".length <= 1) {
    console.log("Let's go down the first road!"); //Not needed.
}
else { //Else if statement not needed.
    // What should we do if the condition is false?  Fill in here:
    console.log("Fun");
}

#5

Thanks guys that worked. Java script is really confusing for me so. :eyeglasses::smile: