What is the difference between == and === ?

Solution

JavaScript provides both strict(===) and type-converting equality(==).  A strict comparison (e.g., ===) is only true if the operands are of the same type whereas == converts the operands to the same type before making the comparison.

For example:

10 == 8  false
10 == 10 true
10 == "10"  true
10 === 10  true
10 === "10"  false

Share this thread

Comments

Comments
comments powered by Disqus

Navigation

Social Media