
What is Triple Equal in JavaScript?
Javascript uses two different equal signs for equality comparisons. You have abstract and strict equality comparison, or more commonly known as double and triple equal.
The triple equal operator is used to check for strict equality. This means that in order to define two values as equal, both the type and their value must match.
// Here we check for both value and type, therefore this will return false
'1' === 1
Copied to clipboard!
Double equal on the other hand only compares values, meaning different types can be equal if their value matches.
// Here we only check for value, therefore will return true:
'1' == 1
Copied to clipboard!
When dealing with equality checks, you should always useΒ ===
Β to test for equality, otherwise your code may contain unexpected results.

Looking to improve your skills? Check out our interactive course to master JavaScript from start to finish.

Resources:
π More Webtips
Master the Art of Frontend
Unlimited access to hundred of tutorials
Access to exclusive interactive lessons
Remove ads to learn without distractions