Example 1 — Intentional fall-through
Share one body for several cases.
JavaScript
const k = "a";
switch (k) {
case "a":
case "b":
console.log("a or b");
break;
default:
console.log("other");
} How It Works
- case a has no break, so it falls into the shared body.
- Then break ends the switch.
