What is wrong with this?


#1


Can somebody pleas help me? I can´t understand what is wrong with that code


// Check if the user is ready to play!
confirm("Are you ready to play?")
var age = prompt("What´s your age?")
if(age<13)
{
console.log("Not allowed to play")
}else{
console.log("Allowed to play!");
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Bieber on stage?")
if (userAnswer === "yes") {
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")
}
else {
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")
}



#2

You have to add a semi colon after your console.log's and variables ;


#3

Still doesn´t helping...


#4

as @bandit said missing semi colons also your first else statement is not closed

Add semi colons on ALL console.log(); and variables as well as confirm


#5

confirm("Are you ready to play?");
var age = prompt("What´s your age?");
if(age<13);
{
console.log("Not allowed to play");
}else{
console.log("Allowed to play!");
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");
var userAnswer = prompt("Do you want to race Bieber on stage?");
if (userAnswer === "yes");
{
console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
}else{
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
Like this??? Or what???


#6

Remove the semi colon here.


#7

I did it. Is there more mistakes? It keep telling me error -.-


#8

What error is it giving now?


#9

" Oops, try again. There was a problem with your syntax. " this one


#10

You never put a closing bracket after the console.log


#11

Like should I change something and replace that or I should just add this to somewhere?


#12

No just add this } after the console.log of that else statement


#13

but this is still not letting me to move on...


#14

Maybe you could send me the code as it should look that?


#15
confirm("Are you ready to play?")
var age = prompt("What's your age?");
if(age < 13) {
    console.log("Not allowed to play")
} else {
    console.log("Allowed to play!")
}

console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'")

console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'")

var userAnswer = prompt("Do you want to race Bieber on stage?")

if (userAnswer === "yes") {
    console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!")
}
else {
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")

This is how your code is right now after having made all the changes. Try run it. :slight_smile:


#16

Omg!!! Thank you! It finally worked!


#17