The code passes but it's not working


#1

var user = prompt("You are walking through a notoriously dangerous bog, when OH NO!!! A hydra pops out and wants to eat you! Should you FEED him by giving him a toenail clipping, FIGHT him, RUN away or SWIM away?").toLowerCase();
switch(user) {
case 'feed':
console.log("Oh, no! You irritated the hydra, which devoured you on the spot!");
break;
case 'fight':
console.log("I hope you're good. You pull out a silver sword and slice one of the hydra's heads off. But now two grow back, even more vicious! You go on a head slicing spree, but now you're surrounded by heads. You're toast.");
break;
case 'run':
var speed = prompt("Are you fast? Yes, no or maybe?").toLowerCase;
if(speed === 'yes' || speed === 'maybe') {
console.log("The hydra is in hot pursuit and- wait! Hydra's can't go on land, so you get away safely! Hooray!");
} else {
console.log("The hydra catches up and you are eaten.");
}
break;
case 'swim':
var sweet = prompt("Are you a good swimmer? Yes or no?").toLowerCase;
if (sweet === 'yes' && sweet === 'no') {
console.log("You begin swimming, but this is thick, swampy bog water. The hydra, who is used to swimming fast in this environment, quickly catches you. You died.");
}
break;
default:
console.log("Oops, that's not an option. You take too long trying to figure out what else you can do and the hydra devours you.");
}
If I choose "run" and type "yes" I get the response for no. And if I choose "swim" and type anything I get a blank console. Why?


#2

modify this line

var sweet = prompt("Are you a good swimmer? Yes or no?").toLowerCase;

to

var sweet = prompt("Are you a good swimmer? Yes or no?").toLowerCase();

do the same with the run block


#3

But what about this?


#4

try == instead of ===