Ripped from my blog: keithdonegan.com
The Equality Operator (==)
The equality operator (==) checks whether two operands are the same and returns true if they are the same and false if they are different.
The Identity Operator (===)
The identity operator checks whether two operands are “identical”.
These rules determine whether two values are identical:
- They have to have the same type.
- If number values have the same value they are identical, unless one or both are NaN.
- If string values have the same value they are identical, unless the strings differ in length or content.
- If both values refer to the same object, array or function they are identical.
- If both values are null or undefined they are identical.