Double equals vs Triple equals in JavaScript
Difference between == and === or double equal vs triple equal operators in JavaScript,
JavaScript has both strict and type-converting equality comparison Operators.
JavaScript has both strict and type-converting equality comparison Operators.
Double equal (==) in JavaScript
0 == false // true
1 == true // true
1 == "1" // true, auto type coercion
null == undefined // true, auto type coercion
Triple equal (===) in JavaScript
0 === false // false, because they are of a different type
1 === true // false, because they are of a different type
1 === "1" // false, because they are of a different type
1 === 1 // true, because they are of a similar type
null == undefined // false, because they are of a different type