How to use the the fall-through feature of the switch in JavaScript

1 Answer

0 votes
const lang = "c++"

switch (lang) {
   case "c":
   case "c++":
   case "c#": 
       alert("c c++ c#");
       break;
   case "javascript": 
       alert("javascript");
       break;
   default: 
       alert('Default case');
}


/*
run:

c c++ c#

*/

 



answered May 2, 2020 by avibootz
...