Javascript never stops surprising you.
Try this out.
1 |
null > 0 //false |
then try
1 |
null == 0 //false |
then once opon a time try this
1 |
null >= 0 //true |
What really happens is that the Greater-than-or-equal Operator (>=), performs type coercion (ToPrimitive), with a hint type of Number, actually all the relational operators have this behavior.
null is treated in a special way by the Equals Operator (==). In a brief, it only coerces to undefined:
1 2 |
null == null; // true null == undefined; // true |
Value such as false, ”, ‘0’, and [] are subject to numeric type coercion, all of them coerce to zero.






