The ==
operator will compare for equality after doing any necessary type conversions. The ===
operator will not do the conversion, so if two values are not the same type ===
will simply return false
. Both are equally quick.
For value types (numbers):a === b
returns true if a
and b
have the same value and are of the same type.
For reference types:a === b
returns true if a
and b
reference the exact same object.
For strings:a === b
returns true if a
and b
are both strings and contain the exact same characters.
Source: Stack overflow