I do not know what I missed here because it does not prompt any error.
I even completed the coding of the game and it worked finely except for one thing... the storyline jumps like this:
- Question if ready to play
- Question on player's age
- Question if player wants to race with Justin Bieber
- Request for feedback
- Whole narrative shows at once (texts about the introduction, the story, and the response re feedback).
Here's the code I used:
// Check if the user is ready to play!
confirm("Are you ready to play?");
// Check player age.
var age = prompt("How young are you?");
// Insert disclaimer if less than ideal age.
if(age < 13)
console.log("My dear, I will not kick you out but if you continue to play the game, I take no responsibility for you. Sorry. :(")
console.log("Just the right age! Let's beging this aweeeesome game!")
// Set up the scene for your story.
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!")
console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'")
var feedback = prompt("Kindly rate this game.")
if(feedback > 8)
console.log("Thank you! We should race at the next concert!")
console.log("I'll keep practicing coding and racing.")