I keep getting default answer for some reason


var user = prompt("whats you favorite scary movie?").toUpperCase();
case 'Halloween':
console.log("ooh Michael Myers!");
console.log("H20 sucks")
case 'night of the living dead':
if('night of the living dead'||'walking dead'){
console.log("more brains!")
case 'chucky':
console.log("dolls are scary");
console.log("thats not scary");


It has to do with the string manipulation being done on the prompt() return value.


turns all characters into capitals,

halloween => HALLOWEEN

so the cases need to match all upper case text expressions.

Personally, I recommend against this practice and favor the more reliable approach of testing the return value before applying a string method. Not all returns are strings, which will throw a fatal error when a method is called on them. Try clicking Cancel or press the Esc key.

var user = prompt(" ... ").toUpperCase();

The compiler will throw an error with something like,

TypeError: Cannot read property 'toUpperCase' of null

If we respect this as a user's wish to exit the program, or some loop in the program, then we always have an exit plan. prompt() used in a loop without an exit plan can be a pain since we lose the page.