Douglas Crockford’s Javascript: The Good Parts:
JavaScript has two sets of equality operators:
===and!==, and their evil twins==and!=. The good ones work the way you would expect. If the two operands are of the same type and have the same value, then===produces true and!==produces false. The evil twins do the right thing when the operands are of the same type, but if they are of different types, they attempt to coerce the values. The rules by which they do that are complicated and unmemorable.
Double Equals (==)
Double equals (==) will try to convert the 2nd half to the same type as the first half
of the expression.
string == number will result in a comparison to string == string after the conversion.
Triple Equals (===)
Triple equals === is just a straight comparison, regardless of type.
Using === is not any quicker if the types are the same. If types are not the
same, === will be quicker because it won’t try to do the conversion.