Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

multiple case switch javascript

switch (varName)
{
   case "afshin":
   case "saeed":
   case "larry": 
       alert('Hey');
       break;

   default: 
       alert('Default case');
}
Comment

JavaScript switch With Multiple Case

// multiple case switch program
let fruit = 'apple';
switch(fruit) {
    case 'apple':
    case 'mango':
    case 'pineapple':
        console.log(`${fruit} is a fruit.`);
        break;
    default:
        console.log(`${fruit} is not a fruit.`);
        break;
}
Comment

how use multi things in in switch case in js

let text = "hello";
switch(text){
  case "hello": 
  case "hi":
  case "hey":
    //some code
  break;
}
Comment

JavaScript switch With Multiple Case

// multiple case switch program
let fruit = 'apple';
switch(fruit) {
    case 'apple':
    case 'mango':
    case 'pineapple':
        console.log(`${fruit} is a fruit.`);
        break;
    default:
        console.log(`${fruit} is not a fruit.`);
        break;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: regular expression match text between quotes 
Javascript :: express get query params from url 
Javascript :: remove the items in array which are present in another javascript 
Javascript :: how to create public folder in node js 
Javascript :: loop through an array in javascript 
Javascript :: how to check if radio button is checked javascript 
Javascript :: javascript trim spaces 
Javascript :: select add option js 
Javascript :: express download file 
Javascript :: js image on canvas 
Javascript :: return the next higher prime number javascript 
Javascript :: dayjs timezone 
Javascript :: bootstrap cdn for react 
Javascript :: javascript transpose rows to columns 
Javascript :: jquery data attribute 
Javascript :: detect system dark mode javascrip 
Javascript :: how to test usestate in jest 
Javascript :: how to cut a string uptil specific character javascript 
Javascript :: sort array based on another array 
Javascript :: install plotly with react 
Javascript :: read csv file in javascript 
Javascript :: vue.js cdn script 
Javascript :: how to generate color code from random number 
Javascript :: electron no menu bar 
Javascript :: javascript on image load 
Javascript :: dotenv nodejs 
Javascript :: roblox headshot image js 
Javascript :: lodash filter object keys 
Javascript :: transitionduration js 
Javascript :: javascript get 24 hour time 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =