This forum is now read-only. Please use our new forums! Go to forums

0 points
Submitted by Richard Wentford
about 10 years

[resolved] Oops, try again. Your code doesn't look quite right. Check the Hint if you need help!

confirm(“I am ready to play!”); age = prompt(“What’s your age”); if(age < 13) { console.log(“You can play but we take no reponsibility”); } 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.’”); }

say in console ‘Referenceerror: yes is not defined’.

Answer 532071d680ff3320d0006309

0 votes

Permalink

Hey, problem is in this line:

if (userAnswer === yes) {

In this line you are checking if variable userAnswer is equal to variable yes. You should check if userAnswer is equal to word / string "yes":

if (userAnswer === "yes") {
points
Submitted by Maciej Wiercioch
about 10 years

2 comments

Richard Wentford about 10 years

Thanks a lot!

Maciej Wiercioch about 10 years

You’re welcome :)

Answer 5320875e8c1ccce2440071a6

0 votes

Permalink

Guys I need your help. This is where I am. 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.’”) }

What am I doing wrong?

points
Submitted by Jacopo Pozzi
about 10 years

1 comments

Maciej Wiercioch about 10 years

Check my answer below :)

Answer 53209884631fe954bd0045b3

0 votes

Permalink

@Jacopo, you just need to add at first lines code from previous exercise, example:

confirm("I am ready to play!");
var age = prompt("What's your age");
if (age < 13) {
    console.log("You can play, but I take no responsibility");
} 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.'");
}
points
Submitted by Maciej Wiercioch
about 10 years

1 comments

Jayadeep Yenikapati about 9 years

Awesome bro!!! I worked

Answer 53209bc69c4e9dbdad00014f

0 votes

Permalink

Thanks bro!

points
Submitted by Jacopo Pozzi
about 10 years

1 comments

Maciej Wiercioch about 10 years

You’re welcome!