JavaScript can be a tricky language, with many gotchas. In this contrived example a simple function is returning within a switch. There is no break, as the function will immediately return.
function getUpperName (animal) {
switch(animal) {
case 'dog':
return 'Dawg';
case 'cat':
return 'Kitty';
default:
return 'Unknown';
}
}
Is this considered bad form and could it have unwanted side-effects? Or is this standard JS programming.