➕sloppy equality (==)
equality with type conversion.
JS ⟩ statement ⟩ expression ⟩ operator ⟩ relational ⟩ sloppy (==)
perform equality testing that allows type conversion.
🌟
👉 compare:strict equality (===)
convertibility does not imply equality❗
// ⭐️ `undefined` can be converted to `false`.
undefined == false // false❗ <= and >= do not rely on == or ===❗
replit: sloppy equality (==)
// ⭐️ sloppy equality (==)
null == undefined, // true
0 == '0', // true ('0' -> 0)
0 == false, // true (false -> 0)
1 == true, // true (true -> 1)
'1' == true, // true (true -> 1, then '1' -> 1)
'0' == false, // true (false -> 0, then '0' -> 0)
// ⭐️ convertibility doesn't imply equality
// (undefined can be converted to false)
undefined == false, // false❗ 🌟
ℹ️ the following are involved in
==operation.
Last updated
Was this helpful?