Else condition not printing even when prompt response is false


#1

I cannot understand why, with the below code, the "oh no!" response does not print when I do not answer yes to the prompt. code academy gives me credit for the answer but I don't understand why the else condition is not printing. can anyone advise. Code below:
// Check if the user is ready to play!
confirm("Let's play this game. You ready champ?");
var age;
age=prompt("How old are you?");
if (age>13){
console.log("carrry on. Have fun playing.");
}
else {
console.log("must be 13 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"||"y") {
console.log("You and Bieber start racing. Its neck and neck! You win by a shoelace!");
}
else {
console.log("Oh no! Bieber shakes his head and sighs 'I set a pace, so I can race without pacing.'");
}


#2

Hi @systemsolver08393,

Please see the code sample below, in short just one tiny gremlin here, when you are comparing for multiple conditions, you need to fully write out the expression to compare.

// Check if the user is ready to play!
confirm("Let's play this game. You ready champ?");
var age;
age=prompt("How old are you?");
if (age>13){
console.log("carrry on. Have fun playing.");
}
else {
console.log("must be 13 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"||userAnswer==="y") { //omparision needs to be fully written for each condition
console.log("You and Bieber start racing. Its neck and neck! You win by a shoelace!");
}
else {
console.log("Oh no! Bieber shakes his head and sighs 'I set a pace, so I can race without pacing.'");
}

#3

So check it out on line #5,

After I created the variable, I created ---> "myAge is > 13" and this worked! By the way I'm on Internet Explorer 8.1, Merry Coding!