JavaScriptBeginner#operators#coercion

Explain == vs ===.

=== compares type and value with no conversion. == performs type coercion first, which produces surprising results, so prefer === everywhere except the idiomatic x == null check.

Example
0 == '0';   // true
0 === '0';  // false
null == undefined;  // true
null === undefined; // false

Related Questions

1
JavaScriptBeginner#coercion

What are truthy and falsy values?

Open
2
JavaScriptIntermediate#this#functions

How does 'this' work in JavaScript?

Open
3
JavaScriptIntermediate#functions#this

Difference between call, apply and bind?

Open