[2.6 Asking for feedback] returning SyntaxError: missing before statement


#1

2.6 Asking for feedback

Hello everyone

Somehow I get the error message "missing before statement" the second time already. The first time I copied the code from someone else, which got it to work (dunno why) regarding that my code was the same except for the idividually selectable strings. So here is my code:

confirm("Are you READY?");

var age = prompt("Whats your age?");

if (age < 13){
    console.log("You are allowed to play BUT on your own responsibility");
}

else{
    console.log("Well then, let's go!");
}

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 = confirm("Do you want to race Bieber on stage?");

if (userAnswer === true){
    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.'");
}
//The parts before worked out without errors; So the following part must return that error, any ideas?
var feedback = prompt("Rate the game from 1 to 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.");
}

Thanks in beforehand :slightly_smiling:


#2

it's unlikely someone will answer with a boolean of true,

why not see if they input a string equalling to yes

Also it's a lot better for you if you don't copy code, if your stuck come here and ask for help and we will help you, because it's explained to you why things work rather than copying from someone else and having no idea why something works :slightly_smiling:


#3

That's why I came here now.... Well I thought if you ask for confirmation ok returns true, cancel returns false... And actually this part worked so it's the part after with the feedback that got me the error... :frowning:


#4

mmk,

Look at your if and else statement, (specifically If and else)

Do you see anything that should be there?


#5

Well, I got it..... I can't write "If" capitalized... needs to be "if".... wow, javaScript, wow.......... Thank you for pointing me in the right direction :slightly_smiling: