JavaScript · Junior · Question 8 of 75

How does == differ from ===?

Explanation

0 == '' and '1' == 1 are true because of coercion, but false with ===. Loose equality rules are confusing, so === is almost always used. A handy exception: x == null checks for both null and undefined at once.

Further reading

Problem with a question

JavaScript · Junior · question 8

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz