About 50 results
Open links in new tab
  1. Switch statement for multiple cases in JavaScript

    The switch statement is used to select one of many code blocks to execute based on a condition the value in the switch expression is compared to the different values provided

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

    Jan 29, 2020 · But essentially a switch statement in Javascript will only accept 1 expression followed but multiple outcomes of that expression. Which within each specific case you can act on that outcome.

  3. JavaScript conditional switch statement - Stack Overflow

    Is there a way to write a conditional switch statement in JavaScript? I'm guessing not, since the following is always going to default: var raw_value = 11.0; switch(raw_value) { case (raw_value...

  4. When to use Switch and If else statement? - Stack Overflow

    1 as stated in MDN: The switch statement evaluates an expression, matching the expression's value to a case clause, and executes statements associated with that case, as well as statements in cases that …

  5. javascript - Switch statement for greater-than/less-than - Stack Overflow

    } 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 case in source …

  6. 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 value.

  7. 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: switch (

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

    Jun 17, 2013 · 60 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 example:

  9. Switch statement for string matching in JavaScript

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

  10. 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 execution at the …