Code Your Own Adventure 2! 4/6 (switch)


#1

I understand that the instructions state to list at least three different cases, but I wanted to experiment with one, with a similar structure on 1/6. When I try to submit the code, this is what shows up: SyntaxError: Unexpected token var. I would at least expect to say that two more cases are needed, but I do need help in figuring out the the syntax error(s) is/are. Thank you.

var user = prompt("What weapon do you choose?").toUpperCase();

switch(user) {

case 'gun'
var afraid = prompt("Are you afraid to kill(YES or No)?").toUpperCase();
var brave = prompt("Are you brave?").toUpperCase();
if(afraid === 'No' && brave === 'YES') {
console.log("You can't be afraid to use a gun!");
} else {
console.log("You need to be brave to use a gun!");
} break;

default:
console.log("Nice choice!");
}


#2

Missing a colon at the end.

Change 'No' to 'NO'. You changed the response to UPPERCASE, remember?


#3

I made the above suggested changes, and I'm still getting a syntax error.


#4

Update: I changed the semi-colon (after "case 'gun' ") to a colon and the code worked! Thank you guys.