What value types can be used for case comparisons in a switch statement?

  • Strings, numbers, and symbols
  • Arrays, objects, and booleans
  • Only numbers and booleans
  • Functions and undefined values
In a switch statement, you can use strings, numbers, and symbols as values for case comparisons. These values are compared strictly, meaning both value and type must match for the associated code block to execute.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *