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.
Loading...
Related Quiz
- When a function expression is made async, it returns a ______.
- How does JavaScript support lexical scoping?
- You are debugging a web page and find that an element isn't being selected as expected with document.querySelector('.example'). What could be a possible reason if the class name is correct?
- What is a property in JavaScript objects?
- How does the “for...of” loop differ from the traditional "for" loop?