js.l15 code example
Example: js.l15
case value:
break;
default:
break;
}
EXAMPLE:
---------
const day = `monday`;
switch (day) {
case 'saterday':
console.log(`This is "SATERDAY" !`);
console.log(`Its my Walking day`);
break;
case 'sunday':
console.log(`This is "SUNDAY" !`);
console.log(`Its my Working day`);
break;
case 'monday':
console.log(`This is "MONDAY" !`);
console.log(`Its my Native day`);
break;
case 'twesday':
console.log(`This is "TWESDAY" !`);
console.log(`Its my Driving day`);
break;
case 'wednesday':
console.log(`This is "WEDNESDAY" !`);
console.log(`Its my School day`);
break;
case 'thusday':
console.log(`This is "THUSDAY" !`);
console.log(`Its my Shooping day`);
break;
case 'friday':
console.log(`This is "FRIDAY" !`);
console.log(`Its my Holy day`);
break;
default:
console.log(`error.....`);
break;
}
EXAMPLE:
---------
const True = 1;
const False = 1;
switch (true) {
case (True === 0 && False === 0):
console.log(`OFF`);
break;
case (True === 1 && False === 0):
console.log(`OFF`);
break;
case (True === 0 && False === 1):
console.log(`OFF`);
break;
case (True === 1 && False === 1):
console.log(`ON`);
break;
default:
console.log(`ERROR......`);
break;
}