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 :: get user time using timezone javascript 
Javascript :: js html tag valu 
Javascript :: javascript random number up to including 2 
Javascript :: email regular expression javascript 
Javascript :: javascript get sub array 
Javascript :: check upload img extension jquery 
Javascript :: antd dropdown stop propogation 
Javascript :: js undici fetch data 
Javascript :: preloader 
Javascript :: input on change angular 2 
Javascript :: make input not editable for user js 
Javascript :: map of filtered data react 
Javascript :: adding element to javascript object 
Javascript :: jquery get dropdown list selected value 
Javascript :: can you call a function within a function javascript 
Javascript :: how is javascript compiled 
Javascript :: insert property multiple documents mongodb 
Javascript :: integer to array javascript 
Javascript :: window.addeventlistener 
Javascript :: vue scroll div to bottom 
Javascript :: npm is not recognized 
Javascript :: how to handle fetch errors 
Javascript :: what is virtual dom in react 
Javascript :: promise.race 
Javascript :: javascript redirect with extra url arguments 
Javascript :: jquery select option by value 
Javascript :: regex start line 
Javascript :: duplicate elements of array multiple times 
Javascript :: add json object to json array javascript 
Javascript :: create an element jquery 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =