Pro at rating, thanks


#1

prob near the end at the rating part, syntax error

// Check if the user is ready to play!
confirm("I am ready to play");
var age = prompt("What's your age");

if (age < 13){ console.log("you can play,but we have 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?'");
confirm ("Do you want to race Bieber on stage?");

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

var feedback = prompt ("rating 1 through 10");

if feedback = (>8) { console.log ("Thank you! We should race at the next concert!")}
else { console.log.(I'll keep practicing coding and racing.")}


#2

That is not how you are supposed to make an if statement.

This is the wrong way to use an if statement, for you are putting the parentheses AND the comparators incorrectly.

if(_____ >= ___)

This is the correct structure in making an if statement.

Hope it helped!:smiley:


#3

thanks, I have changed it to
if (feedback >=8) and still said missing name after operator?

I can not find this


#4

Thanks.
changed it to
if (feedback>=8)

but still said missing name of operator?
I can not see it
Thanks you for your help


#5

// Check if the user is ready to play!
confirm("I am ready to play");
var age = prompt("What's your age");

if (age < 13){ console.log("you can play,but we have 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?'");
confirm ("Do you want to race Bieber on stage?");

if ("yes") { console.log("You and Bieber start racing. It's neck and neck! You win by a shoe lace! ")}

else { console.log ("Oh no! Bieber shakes his head and sings I set a pace");}
confirm ("Please rate this game 1 through 10");
var feedback = prompt ("rating 1 through 10");

if (8 <=feedback) { console.log ("Thank you! We should race at the next concert!")
}

else { console.log. (I'll keep practicing coding and racing.");
}


#6

You have another issue with your code in this block.

The confirm(".....") returns a boolean value of true or false, not "yes" or "no", depending on if the user clicks OK or cancel.

Also, you need to have a proper boolean value, true or false, for the if statement to evaluate correctly, otherwise you should be comparing two values using one of the following: >, <, <=, >=, ===, != inside the if(....)

The following would be two examples showing you how the confirm dialog box works. One with the confirm(...) being directly evaluated by the if state, and another storing the confirm(...) result in a variable, then evaluating the variable.


if(confirm("Do you want to go forward?")){
    console.log("You said yes.");
}else{
    console.log("You said no.");
};


confirm_result = confirm("Do you want to go forward?")
if(confirm_result){
    console.log("You said yes.");
}else{
    console.log("You said no.");
};


#7

thanks, I still have problems. Is there a correct copy of this lesson so I can find the operator error?


#8

Read through your code again, you've got a simple mistake somewhere in this block of code.

else
{
     console.log. (I'll keep practicing coding and racing.");
}