The story heats up!


#1

confirm("I'm ready to play!");
var age(prompt)("What's your age");
if(13>age){
    console.log("you are young");
}
else{
    console.log("Let's Start!");
}
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=confirm("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.'");
    }

Please I need help and a explanation


#2

What is it you need help with, exactly?


#3

He has an unexpected ) so seemingly he has an extra ) somewhere However, I have not found one yet


#4

So I got rid of the ) error by un () prompt. Then you get SyntaxError: Unexpected identifier Still looking for this one


#5

Ah found it!

You also need to set the var age equal to prompt so like this:

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

That fixed all the problem from your code that I pasted over to my lesson and fixed so hopefully that helps! :smiley:


#6

I try it but,unfortunately I get a unexpected identifier ,I donĀ“t know why.


#7

Thanks for try helping me, I start from the beginning again.And now it works!

confirm("I'm ready to play!");
var age=prompt("What's your age");
if(13>age){
console.log("Sorry you are too young");
}
else{
console.log("Let's Start!");
}
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

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


#8

Thank you for help !!!!!!!!!


#9

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.