First Move


#1

// Check if the user is ready to play!
confirm("Ready to begin");
var age=prompt ("How old are you");
if(age<=13) {
console.log("Player is allowed to play but not responsible for player");
} 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?");
confirm(yes) {
console.log("Let's get it!");
} else{
console.log("Nope!");
}
//Not sure about this?


#2

Hi,

all issues detected:

  • first issue: look at your 9 and 10 lines 1. console.log("You are at a Justin Bieber concert, and you hear this lyric "Lace my shoes off, start racing."); and 2. console.log("Suddenly, Bieber stops and says, "Who wants to race me?");

More specifically there is a mistake in this area: "Lace my shoes off, start racing." and "Who wants to race me?"
Solution: remove one quote before Lace and one quote before Who!

  • second issue: look at your 12 line confirm(yes) {
    Solution: change it to if (confirm == "yes") {
    Note: In this case you will add the second if/ else statement

  • and next one: change your "Suddenly, Bieber stops and says, "Who wants to race me?" to "Suddenly, Bieber stops and says, 'Who wants to race me?'"
    Wrap the the phrase in single quotes Who wants to race me? and Lace my shoes off, start racing

  • and last thing: look at if (confirm == "yes") again and change confirm to userAnswer

Here is your corrected code:

// Check if the user is ready to play!
confirm("Ready to begin");
var age=prompt ("How old are you");
if(age<=13) {
console.log("Player is allowed to play but not responsible for player");
} else if (age > 13 && age < 18) {
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("Let's get it!");
} else {
console.log("Nope!");
}
//Not sure about this?

Now your code is completely correct!


#3

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