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 · Indeed you can have a function with multiple if statement then return lettergrade. Or still use the current logic with some modification and still utilize switch().

  3. JavaScript switch statement - Stack Overflow

    Aug 19, 2013 · 10 I have problem in some JavaScript that I am writing where the Switch statement does not seem to be working as expected.

  4. 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 (

  5. 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...

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

  7. javascript - Switch statement with numeric values - Stack Overflow

    Jan 5, 2017 · JavaScript's switch does have a feature that makes it possible to use switch here, but an if/else if/else is almost certainly a better choice. Purely for completeness:

  8. 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 …

  9. javascript - Is returning out of a switch statement considered a better ...

    Is returning out of a switch statement considered a better practice than using break? [closed] Asked 14 years, 8 months ago Modified 2 years, 8 months ago Viewed 243k times

  10. 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 …