When can I use “switch case” statements?

Nikhil Nambiar
1 min readFeb 9, 2020

--

When you have to compare a single value against many different values and then perform different actions based on the value.

let day = "Friday"

switch(day.toLowerCase()) {
case "monday": console.log("Go run")
break;
case "tuesday":
case "wednesday":
case "thursday": console.log("work work")
break;
case "friday": console.log("party")
break;
default: console.log("Meditate")
}// party

--

--