I’m wondering why the case statements aren’t deflecting code execution when false:
switch (prompt("What is the weather like?")) {
case "rainy":
console.log("Remember to bring an umbrella.");
break;
case "sunny":
console.log("Dress lightly.");
case "cloudy":
console.log("Go outside.");
break;
default:
console.log("Unknown weather type!");
break; }
When typing in “sunny” into the console, it outputs both “dress lightly” and “go outside”. No break of course means that it continues on to evaluate “cloudy”, but why would that case execute if that wasn’t the string?