"SyntaxError: missing before statement" Stuck! code-your-adventure-2-logical-operators/


#1

code-your-adventure-2-logical-operators/


```

var user = prompt("You are swimming off the coast of Nerja and encounter a giant jellyfish the size of a baby calf. You can FIGHT, SWIM away, or PRETEND to be a shark.").toLowerCase();

switch(user) {
    case 'fight':
        var punch = prompt("Do you want to punch the jellyfish, YES or NO?");
        var kick = prompt("How about karate-kicking the jellyfish? YES or NO?");
        if (punch && kick == "yes") {
            console.log("Your punch kills the jellyfish but the kick was useless!");
        } else if (punch == "yes") {
            console.log("You knock the jellyfish unconscious.");
        } else if (kick == "yes") { 
            console.log("Seriously? Your kick is too slow underwater. The jellyfish traps you in it's tentacles and devours you slowly over a period of say, a couple of weeks.");
        }
    
        break;
        
    case 'swim':
        var breastStroke = prompt("Do you want to swim breast stroke? YES or NO");
        var frontCrawl = prompt("Do you want to swim front crawl? YES OR NO");
        if (breastStroke || frontCrawl) {
            console.log("You're a good swimmer, the jellyfish can't match your pace. You count yourself lucky this time.");
        } else {
            console.log("You swim freestyle. To your surprise the jellyfish swims butterfly with a well-practiced technique. When it catches you it devours your body over a period of say, a few weeks.");
        }
        
        break;

    case 'pretend':
        var fin prompt("Place your hand on your back and pretend it's a shark fin? YES OR NO");
        var face prompt("Do you want to bare your teeth like a shark? YES OR NO");
        if (fin || face) {
            console.log("It turns out that the jellyfish is of below-average intelligence. It worked. You pat yourself on the back. Steak tonight!"); 
        } else {
            console.log("You didn't even try to be a shark?! Your laziness has been fatal this time. You have brought shame on your family, and the movie industry as a whole.");
        }
        
        break;
        
    default:
        console.log("Please type your choice correctly");
}

`


#2

Hi... Does the Syntax Error state which line your error is on?


#3

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