Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Another point of contention with regard to switch is
whether a default case is required.
Some believe that a default should
always be included even if the default action is to do nothing, as
in:
switch(condition) {
case "first":
// code
break;
case "second":
// code
break;
default:
// do nothing
}
You’re likely to find open source JavaScript code following this
pattern, including default and just
leaving a comment that nothing should happen there. Although no style
guides are explicit about this, both Douglas Crockford’s Code Conventions for the JavaScript
Programming Language and the Dojo Style Guide include default as
part of their standard switch
statement format.