var day;
switch (new Date().getDay()) {
case 0:
day = "Sunday";
break;
case 1:
day = "Monday";
break;
case 2:
day = "Tuesday";
break;
case 3:
day = "Wednesday";
break;
case 4:
day = "Thursday";
break;
case 5:
day = "Friday";
break;
case 6:
day = "Saturday";
}
"Today is " + day;
result= Tuesday
T he switch statement executes a block of code depending on different cases. The switch statement is a part of JavaScript's 'Conditional' Statements, which are used to perform different actions based on different conditions. ... The switch statement is often used together with a break or a default keyword (or both).