You can use fall-through:
switch (pageid)
{
case "listing-page":
case "home-page":
alert("hello");
break;
case "details-page":
alert("goodbye");
break;
}
More Related Contents:
- Turn if-else-if statement into switch statement in Javascript
- Switch statement for multiple cases in JavaScript
- Switch statement for greater-than/less-than
- Expression inside switch case statement
- Switch on ranges of integers in JavaScript [duplicate]
- How can I use ranges in a switch case statement using JavaScript?
- Is it safe to assume strict comparison in a JavaScript switch statement?
- Switch Case not showing correct results
- Can I use a case/switch statement with two variables?
- JavaScript switch with logical operators?
- Why is Break needed when using Switch?
- Switch statement for string matching in JavaScript
- How to use dynamic tailwind classes with JS switch statement and pass them correctly in Vue?
- Switch case with conditions
- switch statement to compare values greater or less than a number
- what’s wrong with this javascript script.?
- How can I access a JavaScript object which has spaces in the object’s key?
- jQuery: Get height of hidden element in jQuery
- New es6 syntax for importing commonjs / amd modules i.e. `import foo = require(‘foo’)`
- How do I normalize the CSS3 transition end events across browsers?
- How do I make a div element editable (like a textarea when I click it)?
- Why not always use the index as the key in a vue.js for loop?
- Remove a FileList item from a multiple “input:file”
- Why most JavaScript native functions are slower than their naive implementations?
- How to hide a mobile browser’s address bar?
- iOS WKWebView not showing javascript alert() dialog
- What must be wrapped in then() statements in CasperJS? How to determine execution order of sync/async functions?
- Display an arrow head in the middle of D3 force layout link
- reactjs event listener beforeunload added but not removed
- Is there a way to validate dynamic key names in a Joi schema?