== operator does implicit conversions.
=== exists so you can omit these coercions when you don't need them or don't want them to apply. In many other languages, including dynamic ones (e.g. Python), implicit conversions are vastly less frequent. That is, integers may be converted to floats when doing math or comparing, but
"1" won't go along with
1. In those languages, the
== operator is basically the equivalent of looser language's
To pick up the example, Java goes even further - its
== will only consider two expressions equal if the evaluate to exactly the same reference, i.e. are the same objects (primitive types are, as usual, an exception). You can't get any stricter. What should a
=== do, consider two references equal only if they resulted from the same expressions? ;-)
== uses type coercion for evaluating equality.
0 == false //=> true 1 == true //=> true null == undefined //=> true
=== eliminates type coercion, acting as you would expect the operator to act. If the types are the same and the values are the same it returns true, otherwise false.
Other languages that do not utilize type coercion for equality checks don't need a
=== because that functionality is standard.