4 switch


#1

var user = prompt("What is your favorite color? (Blue or Yellow?)").toLowerCase();

switch (user) {
case: 'blue'
console.log("You may pass the bridge");
break;
case: 'yellow'
console.log("Blue, No, Yelloooooowwww....");
break;
case: 'red'
console.log("A killer rabbit appears out of nowhere and rips your throat open!");
break;
default:
console.log("Tim the Enchanter blasts you with a fireball!");
}

I am getting the "error unexpected token :" message and honestly I cannot see what I am missing?


#2

I think you should put

case 'blue' :
instead of
case: 'blue'

the semicolon placed is important.
correct me if I'm wrong :slight_smile:


#3

Haha the Quest for the Holy Grail? (this isnt like for advice just had to comment xD)