About 12,800,000 results
Open links in new tab
  1. Switch statement for multiple cases in JavaScript

    35 In Javascript to assign multiple cases in a switch, we have to define different case without break inbetween like given below:

  2. using OR operator in javascript switch statement [duplicate]

    Jun 26, 2011 · The optional break statement associated with each case label ensures that the program breaks out of switch once the matched statement is executed and continues …

  3. How can I use ranges in a switch case statement using JavaScript ...

    Jun 17, 2013 · How can I use ranges in a switch case statement using JavaScript? So, instead of writing code for each and every single possibility, I'd like to group them in ranges, For …

  4. javascript - Can I use a case/switch statement with two variables ...

    6 I don't believe a switch/case is any faster than a series of if/elseif's. They do the same thing, but if/elseif's you can check multiple variables. You cannot use a switch/case on more than one …

  5. JavaScript: using a condition in switch case - Stack Overflow

    How can I use a condition inside a switch statement for JavaScript? In the example below, a case should match when the variable liCount is <= 5 and > 0; however, my code does not work: …

  6. javascript - How to use array values as a case in a switch statement ...

    Sep 9, 2022 · 0 you can use only one value at a time in switch statement because switch statement is meant for comparing one value with multiple option that's why we use it. if you …

  7. javascript - switch-case with return and break - Stack Overflow

    Aug 23, 2013 · 8 break tells javascript to stop evaluating cases in the switch block. Code execution continues past the closing switch bracket. The return statement in the example code …

  8. Switch statement for string matching in JavaScript

    May 24, 2010 · Switch statement for string matching in JavaScript Asked 15 years, 5 months ago Modified 2 years, 5 months ago Viewed 370k times

  9. javascript - How to assign a new value in switch case which in a ...

    Jan 29, 2020 · Or still use the current logic with some modification and still utilize switch(). I create another variable for lettergrade, recommend don't modify grade unless you know what you are …

  10. javascript - Switch statement for greater-than/less-than - Stack …

    } switch-range2 This is a variant of switch-range but with only one compare per case and therefore faster. The order of the case statement is important since the engine will test each …