Switch statement

In the lecture on switch statement, it is mentioned that case values are tested with strict equality (===). However in the video he wrote case 1: Is : also mean === ? Please let me know. Thank you.

Iā€™d have to see the exact text, but it is true that switch uses strict equality. As you know:

1 == '1'  // true
1 === '1' // false

So, if the value you are switching on is the number 1, then

case 1:

would catch it, but:

case '1':

would not.

1 Like

Thank you for the explanation.