Why am I reciving the first statement (true) even if user enters no


#1


I am receiving the first sentience even if userAnwer: no


if (userAnswer === "yes" || "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.'");
}


#2

if (userAnswer === "yes" || 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.'");
}

You need the variable twice.


#3

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