Both double equals ==
and triple equals ===
can be used to compare values in javascript - but they are different in a subtle, but very important way. Double equals ==
compares just the value of two things - and if the types are different, it will use type coercion to match the types before comparing. Triple equals ===
compares both the type and value of objects, and both must match before two values are equal.
The same rules apply for not equal !=
(compare value only) and not equal, equal !==
(compare type and value).