You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.log("2" == 2); // true (loose equality performs type coercion)
console.log("2" === 2); // false (strict equality checks type and value)
// String comparison is lexicographical (like a dictionary), not numerical.
console.log("2" > "10"); // true, because the character '2' comes after the character '1'.
console.log(null == undefined); // true (loose equality treats them as the same)
console.log(null === undefined); // false (strict equality knows they are different types)
// A very tricky part of JavaScript!
console.log(null > 0); // false
console.log(null == 0); // false (the equality check `==` has special rules for null)
console.log(null >= 0); // true! Why? Because for relational comparisons (>, <, >=, <=), null is converted to 0. So this becomes (0 >= 0), which is true.