Part 5, considers i typed yes no matter what


#1

no matter what I type at the prompt, it considers i said yes. The program think I made no mistake I could technically go to the nest step but I clearly made one mistake if i can’t trigger the else no matter what i do

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.’”);


#2

"userAnswer === yes" is just a single string, there is no comparison.


#3

i used
if(userAnswer === “yes”)
and it worked. if i dont put strings on the yes it says its not defined

if(feedback>8)
works though. numbers without strings seem to be fine


#4

you might want to do some reading about data types and data structures:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures


#5

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