Switch Statement in JavaScript
Level 295 keystrokes
A switch statement evaluates an expression and executes the matching case block.
JavaScript code
// Declare a variable with value 11let day = 1;// switch evaluates the value of day2switch (day) { // day is 1: print "Mon", then break exits the switch3 case 1: console.log("Mon"); break; // default runs if no case matches4 default: console.log("Other");5}Output
Mon
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
;× 4"× 4(× 3)× 3:× 2.× 2{× 1}× 1=× 1