Javascript - Justin Bieber game - NOT WORKING


I get no error messages, but it doesn't work well. When I'm asked if I want to race, even tho I say "No", it displays the string which should be displayed in case the answer is "Yes". Whatever I answer, it will act like I said "Yes". What's the problem? Thanks!

confirm("I'm ready to play!");
var age = prompt("How old are you?");

if (age < 13) {
    console.log("You're allowed to play but I take no responsibility");

else {
    console.log("Have fun! Good luck!");

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("Please rate the game on the scale from 1 to 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.");


Change your = sign in the if statement to ===.
= Is for assigning values to a variable. === Is for comparison purposes.


Yeah... Just noticed that. xD Thanks anyway man!


Haha alright cool. No problem!


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