Javascript comparison question (null >= 0) [duplicate]

The relational operators (>= and <=), perform type coercion (ToPrimitive), with a hint type of Number, all the relational operators present have this behavior.

You can see the inner details of this process in the The Abstract Relational Comparison Algorithm.

On the other hand, the Equals operator (==), if an operand is null it only returns true if the other is either null or undefined, no numeric type coercion is made.

null == undefined; // true
null == null; // true

Check the inner details of this process in the The Abstract Relational Comparison Algorithm.

Recommended articles:

  • typeof, == and ===
  • Notes on ECMAScript Equality Operators

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)