5. The Story Heats Up!


The following is the error message I'm receiving and my code. The error message appeared after I wrote my own code. Please help.


SyntaxError: Unexpected identifier

confirm("Are you ready to play")
// Check if the user is ready to play!
var age = 15
var age = prompt("What's your age?")
if("age is < 13")
    console.log("You're allowed to play but I will take no responsibility")
else {
    console.log("Have fun!")
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 = prompt("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("Did you like the game?")
    if feedback = prompt("yes")
        console.log("Great! Please play again soon.")
    else {
        console.log("Sorry to hear that.")


you have a extra quation mark on the right side


It's not an extra quotation mark. It's the quotation to close the statement being said. The sentence is 'I set a pace, so I can race without pacing.' and then ") is added to the end to close the code


Yes but you cant have multiple string's in one console.log

You can however put a comma between each string ex (console.log("example 1","example 2")


The error didn't show up though until I wrote my own code.


I took them out and it still doesn't work


Did you put semi-colon at the end of each statement in the original code?


No. I didn't use any semi-colons and the code went through until the end


How About By Checking it with semi-colons


Did that already. I added semi-colons and it still didn't work


ill check it wait a moment


this is my code btw not his just letting you know


the prompts are working the only thing not working is the console.log


My code or his?


Peterlearns_coding yours


Really seems to work for me


ohh yeah i missed a statement lol sorry yep its working


No problem mazharkhan

well niikol is quite lately


I plugged in what you wrote for your code at the end and it works now. Thanks.


Glad to be of your service nikkol :slight_smile: