5. Logical operators. SyntaxError: Unexpected token ILLEGAL


#1


https://www.codecademy.com/en/courses/javascript-beginner-en-ZA2rb/0/5?curriculum_id=506324b3a7dffd00020bf661


SyntaxError: Unexpected token ILLEGAL


var user = prompt("What do you want to do??").toUpperCase();

switch(user) {
    case 'FIGHT':
        var strong = prompt("Are you strong??").toUpperCase();
        var smart = prompt("Are you smart??").toUpperCase();
            if(strong === 'YES' || smart === 'YES') {
                console.log("You only need one of the two!);
            } else {
                console.log("You're not strong OR smart? You lose! You need tese both to win.");
            }
    break;
    case 'RUN':
        var fast = prompt("Are you fast??").toUpperCase();
        var headStart = prompt("Did you get a head start?").toUpperCase();
    if(fast === 'YES' && headStart === 'YES') {
        console.log("You got away--barely!");
    } else {
        console.log("You're not fast and you didn't get a head start? You never had a chance!");
    }
    break;
  default:
    console.log("I didn't understand your choice. Hit Run and try again, this time picking FIGHT or RUN!");
}


#2

Hi this line you didn't close the string

console.log("You only need one of the two!);

#3

Really?? :smiley: thank you. Tried to find the problem few hours :frowning:


#4

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