var number = 15;
switch(number) {
case 5:
console.log(‘number is 5’);
break;
case 10:
console.log(‘number is 10’);
break;
case 15:
console.log(‘number is 15’);
break;
default:
console.log(‘No match found’);
}
An important detail to note is that you don’t need to position the default statement at the end of the statement – you could even position it at the very top. As long as it’s inside the switch statement, its position in the flow is irrelevant.