case statements (in a switch) support comma separated values, to help out when multiple values should be handled the same way (since fall-through isn't implicit and requires continue if separate case statements are used).
The following example logs "bar".
var a = 2;
switch a :{
case 0: console.log('foo');
case 1, 2, 3: console.log('bar');
case 4: console.log('bing');
}
case
statements (in aswitch
) support comma separated values, to help out when multiple values should be handled the same way (since fall-through isn't implicit and requirescontinue
if separatecase
statements are used).The following example logs
"bar"
.