Bug in 5 task "Did you add an if statement to your code? "


#1

My code below, In console this code works perfectly
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.'");
}


#3

can someone solve this crap....its a bug


#4

I also got stuck with this same code as well as with the same error msg.Can someone help me plz?


#5

I found a solution, just need to use the code from other tasks:
// Check if the user is ready to play!
console.log("You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'");
confirm("awegegsdfgsdfg");
var age = prompt("What's your age");

if(age < 13){
console.log("sadfasdfasdf");
}
else{
console.log("sadfasdfasdf");
}
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("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.'")
}


#6

[quote="katrin_m, post:5, topic:24149"]
if(userAnswer == "yes")
this is not working for me.still having same error msg.


#7

mine does the same thing, it just asks for an else statement


#8

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.'")
}

This is what I have, but it always asks for an else statement, even though one is clearly there!


#9

part of it got cut off, here's the full:

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.'")
}


#10

Found the fix guys, you have to put in the code about the age prompt that the lesson deletes from the top, so you have the entire 'adventure':

// Check if the user is ready to play!
confirm("I'm ready to play");
var age = prompt("Whats your age?");
if (age < 13) {
console.log("You're too young for this game");
} else {
console.log("Play on!");
}
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.'");
}


#11

yup

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.'")


#12

its a bug it worked to me


#13

Thank you! It helped!


#14

same here i typed 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?'");
// Check if the user is ready to play!
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.'");
}

even if there are other errors it says i have no if statement?


#15

Thank you stephenhowe! That was the fix to the issue.