default for an on statement js code example

Example 1: javascript switch statement multiple cases

//javascript multiple case switch statement
var color = "yellow";
var darkOrLight="";
switch(color) {
    case "yellow":case "pink":case "orange":
        darkOrLight = "Light";
        break;
    case "blue":case "purple":case "brown":
        darkOrLight = "Dark";
        break;
    default:
        darkOrLight = "Unknown";
}

//darkOrLight="Light"

Example 2: charat javascript in swicth

function getLetter(s) {
  let letter;
  // Write your code here
  switch (true) {
    case "aeiou".includes(s[0]):
      letter = "A";
      break;
    case "bcdefg".includes(s[0]):
      letter = "B";
      break;
    case "hijklm".includes(s[0]):
      letter = "C";
      break;
    case "nopqrstuvwxyz".includes(s[0]):
      letter = "D";
      break;
  }
  return letter;
}