How should I understand these?
null>0
> false
null==0
> false
null>=0
> true
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The relational operators (
>=and<=), perform type coercion (ToPrimitive), with a hint type ofNumber, 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 isnullit only returnstrueif the other is eithernullorundefined, no numeric type coercion is made.Check the inner details of this process in the The Abstract Relational Comparison Algorithm.
Recommended articles:
typeof,==and===