LearnFrenzy
Sign in Take a free test

Conditional Statements · Conditional Statements MCQ · Question 1

How switch compares values Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 1 Back to Exercise

Which comparison does a switch statement use to match a case?

  • A Loose equality (==)
  • B Object.is()
  • C Less-than-or-equal (<=)
  • D Strict equality (===) Correct
Correct Answer: Option D

switch uses ===, so case 2 does not match the string "2", and no type conversion happens.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links