JavaScript Bieber exercise part 6


#1

I haven't been able to pass this last part of the Bieber exercise. I've tried quite a few things but it is still giving me an error. Do you guys see what needs to be changed? Thank you.

// Check if the user is ready to play!
confirm("I am ready to play!");
var age = prompt("What's your age?");
if(13>(age)){
console.log("You can play this game but we take no responsibility");
}
else
{
console.log("Great you can 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.'");
}
var feedback = prompt("Rate this game out of 10");
if (feedback > 8);
{
console.log("Thank you! We should race at the next concert!");
}
else
{
console.log("I'll keep practicing coding and racing.")
}


#2

@toastnjam from next time onwards you should always enclose your code in triple`.
This will format you code automatically and make it easier to read.

// Check if the user is ready to play!
confirm("I am ready to play!");
var age = prompt("What's your age?");
if(13>(age)){
console.log("You can play this game but we take no responsibility");
}
else
{
console.log("Great you can 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.'");
}
var feedback = prompt("Rate this game out of 10");
if (feedback > 8); //Remove THIS semicolon
{
console.log("Thank you! We should race at the next concert!");
}
else
{
console.log("I'll keep practicing coding and racing.") 
}

As for your error, it is because you have a semicolon at the end of if (feedback > 8)


#3

Thank you it worked. Those semicolons are one of the things that seem to cause me problems.


#4

No worries @toastnjam, keep coding hard :smile: !