The behavior you described, where a switch statement continues to execute all statements below a matching case until it encounters a break statement, is indeed by design in JavaScript. This behavior can be both a feature and a potential source of confusion if not used carefully.
The historical reason for this behavior can be traced back to the origins of the switch statement in C and C++. In these languages, the switch statement was designed to provide a compact way to jump to specific sections of code based on the value of an expression. When a matching case was found, control would flow continuously through the subsequent cases unless a break statement was encountered. This behavior made sense in C and C++ because it allowed for more efficient code execution in some cases.
However, in JavaScript, this behavior has been inherited, and it can indeed be a source of confusion for developers who are not familiar with it. To address this, it's generally considered good practice to include break statements after