W3 Schools

Note use of break, otherwise a matched level and all levels underneath it will be evaluated.

const x = 2;

switch(x) {
  case 1:
    console.log('Hello');
    break;
  case 2:
    console.log('Hi');
    break;
  default:
    console.log('Howdy');
}

See also switch in C.