The Story Heats Up


#1

When I run this, it says "SyntaxError: Unexpected end of input"
// Check if the user is ready to play!
confirm("I am ready to play!");
var age = prompt("What's your age");
if (age<13)
{
console.log("You can play, but we take no responsibility for anything");
}
else
{
console.log("Get ready 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 are mainly missing a couple of curly brackets and a couple of semicolons.
Check your if / else statements correctly! Also make sure that console.log and prompt statements end with a semicolon.

// Check if the user is ready to play!
confirm("I am ready to play!");
var age = prompt("What's your age");
if (age<13){
console.log("You can play, but we take no responsibility for anything");
} else {
console.log("Get ready 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.'");
};

#3

This is my code it why is it showing error message ?

confirm (" Are you ready to play ? ");
var age = prompt("What is your age?");
if (age < 13)
{
console.log("You can play this game but we are not responsible");
}
else
{
console.log("We encourage you to play this game");
}
{
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.'");

}


#4

Try this code. --- > Note the use semicolons and curly brackets very carefully.

// Check if the user is ready to play!
confirm("Are you ready");

var age = prompt("What's your age bruh?");

if (age < 13) {
console.log("You are allowed to play but we take no responsibility");
}

else {
console.log("All the best bruh bruh");
}

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


#5

Thankyou so much friend :smile: