In our lives we keep writing code, writing JavaScript, and have little time for conceptual research. I have nothing to do today, I studied the relationship between "null" and "0". I hope you have seen the end of the harvest.
Copy Code code as follows:
Copy Code code as follows:
What does the above code pop up? False? True? is actually true. So why is it? Why is "Null>=0" true? When Null>=0, a strong switch to a numeric type. When making a null>=0 comparison, it is the answer that is obtained by comparing null<0, and if A=b is false, if a=b is true, that is, 0<0 is false, or null<0 is false, then null>0 is true. So null>=0 is true.
Copy Code code as follows:
What does the above code pop up? False? True? is actually false. "Null==0" is a special treatment, does not convert to a numeric type, does not translate to a numeric value, but if the left is a string to the right, the value is converted. "NULL" is an object (empty object with no properties and methods). and "0" is a number. Previously said "= =" does not convert the type, just comparison. So, false.
Why "Null==0" is false, but "null>=0" is true? This little problem is analyzed here. In the process of analysis I also learned a lot of things, I think we can see when there is a certain harvest it. Above all is the personal opinion, if has any understanding not to be in place, welcome to propose, everybody studies together ha.