undefined === undefined || undefined > undefined undefined === undefined || undefined > undefined and undefined >= undefined , OR in "greater than or equal to" does not match this OR || .
How important this is, comparison operators such as >, <, >= , etc., are for numbers, and undefined is not numbers, undefined is undefined.
What do you expect as a return value with 10 >= "Hello World" ? Of course, false, but again 10 >= "10" returns true , because 10 == "10" is true, and 10 === "10" is false. "10" can be converted to a number so that we see the result that would be returned in the case of a real number, and not a string with numbers.
There is no strict version of the equality operator for >= , unlike != , Which !==
Some really strange and confusing things happen when you try to compare null , undefined , NaN - This is what the JavaScript specification can give an answer, and since JavaScript is a very weakly typed language, and the types are very flexible, so you can compare 10 and "10" and get results that you could only get when you compared two integers in most other languages.
Questions and discussion are more welcome than direct voting. Thank.
Deepak Kamat Oct 06 '17 at 15:07 on 2017-10-06 15:07
source share