Greater than and less than

The greater-than (>), less-than (<), greater-than-or-equal-to (>=), and less-than-or-equal-to (<=) operators all operate in a similar manner. They follow an algorithm similar to abstract equality, although how values are coerced is slightly different. 

The first thing to note is that all operands to these operators will first be coerced to their primitive representation. Following that, if their primitive representations are both strings, then they'll be compared lexicographically. If their primitive representations are not both strings, then they'll be coerced from whatever they are to numbers and then compared. This means that even if only one of your operands is a string, they'll both be compared numerically.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.125.7