5/7 no if statement?


#1

Hi,

this is my code:

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 { // Otherwise...
    console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
}

everything is working fine but it keeps telling me that there is no "if-statment"

Anyone an idea why?

Jens


#2

Hi mate,
I had the same problem. I deleted the old code and it seemed like codeacademy was looking for if statement from the previous code challenge.

// Check if the user is ready to play!
confirm("xxxx");
var age = prompt("xxxxx");
if( age < 13 ){
console.log("xxxxxxx");
} else {
console.log("xxxx");
}

Martin


#3

Hi Martin,

thanks for that idea.. I have checked that but i didn't delete the old code. I have checked and is still there and working...

:frowning:

Jens


#4

Thanks....I thought I was going crazy... Its all okay now. I have added the old if statement


#5

Here it is

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

#6

ohhhh.... yes... now i realize what mit "previous" codes was ment. I searched for it in the previous lesson and not in this one.

Thank you very much :smile:


#7

git those dad gum semee coleens out son