Can't figure out number 5. Went line by lane but cant find anything


#1

confirm("i am ready to play")
var age = prompt("What's your age");
if (age < 13){
console.log("You are to young to play this game without parental advisory.")
}
else {
console.log ("Play on!");
}
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 Beiber 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.'");
}

// i dont know whats wrong kernal says unexpected token {
//


#2

check for the missing ";"
I think that could be the problem...


#3

i am not seeing any missing ;
it has to be in the last if else statement because it worked right before that but i cant see anything


#4

even retyped whole code it still wont let me go forward i dont understand. now it says syntax error: expected expression got keyword else


#5

maybe like this?

confirm("i am ready to play");
var age = prompt("What's your age");
if (age < 13){ 
console.log("You are to young to play this game without parental advisory.")
}
else {
console.log ("Play on!");
};
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 Beiber 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.'");
};

But i'm new at this so I don't really know :smile:


#6

I am having the very same problem and I also cannot move forward. It's been days and I want to give up lol


#7

Not sure what to do here..


#8

,this is what I did in my excercise... I'm doing the course in Spanish, so it's just a different text.. but the syntaxis should be the same. This works for me:

confirm("¿Estás listo para jugar?");
var edad = prompt("Cuántos años tenés?");
if (edad<13) {
console.log("Podés jugar, bajo tu propia responsabilidad");
}
else {
    console.log("¡Empecemos a jugar!");
}

console.log ("Ves a Messi caminando por la calle Florida. Está disfrazado y vos sos la única persona que lo reconoce. A su lado camina un guardaespaldas con cara de pocos amigos. Caminás hacia él.");
console.log("Te acercás a Messi. El guardaespaldas te mira con odio.");
var respuestaUsuario = prompt("¿Te animás a enfrentarte al guardaespaldas?");
if (respuestaUsuario === "SĂ­") {
    console.log("El guardaespaldas se ríe. ¡Solo te quería asustar! Claro que podés sacarte una foto con la pulga.¡Sonrían!");
}
else {
    console.log("¡Que lástima! No conseguiste una foto con Messi para subir a tu muro de Facebook.");
}

#9

same problem in 5 lesson i have a sript:

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.'")
}

and i still have error :

"Oops, try again.
Did you add an if statement to your code?"


#10

don't capitalize your "if" statement

change If (userAnswer === "yes"){

to

if (userAnswer === "yes"){


#11

this is my code... i still do get the same error..

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.'");
}


#12

thanks you guys it works


#13

what was ur code?? I want to know how did u solved it.. thank you.


#14

paste the whole code--- the error, might be before this...


#15

i still getting the same error again..


#16

Doesn't it start with a "confirm("I am ready to play!");"?

I know you said it shuold be in the last if/else, but just to check the code you are trying to validate at this moment...


#17

The problem is in line 4:

It is missing a semicolon at the end of the line.


#18

I got the answer

confirm("Are u ready to play!");// Check if the user is ready to play!
var age = prompt("What's your age");
if (age < 13) {
console.log("You can play");
}
else {
console.log("Don't you think you should play a game which is made for you like GTA Sanandreas or
vice city etc. Hope you will");
}
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.'");
}

#19

/* I'm sorry guys I've been afk it looks like kshitij760 code is correct


#20

/* for apple that still need help remember quotations are always important.