What is wrong with this code? Everytime I run it, the debugger says:Oops! try again, tryDid you remember to put in the 'yes' answer option


#1

confirm("I am ready play")
var age=prompt("What's your age");

if(age<=13){
console.log("You are allowed to play but you may be altered by violent matter");
}
else{
console.log("You are allowed to play");
}
console.log("Suddenly, Bieber stops and says, 'Who wants to race me?'");

userAnswer = prompt("Do you want to race Bieber on stage?")
if(userAnswer="yes"){
console.log("Then let's go!");
}
else{
console.log("Who else want's to race me?");
}


#2

Because here its an assignment:

One equal sign is an assignment, it should be a equality operator...

if(userAnswer=="yes"){

I explained more here:


#3

Hi you should put === instead of =


#4

@amanuel2

No it's not a == sign. This is for PHP and Ruby, not JavaScript. :wink:

if(userAnswer==="yes"){

#5

Your wrong @miniapple8888 look at this:

If you say the explanation is wrong, your saying the MDN Docs are wrong.


#6

@wizmarco the only difrence between === and == is that the strict equality operator is checking if it is also the same type..