The Relational Group of Operators:
less-than (<)
greater-than (>)
less-than-or-equal (<=)
greater-than-or-equal (>=)



Navigation Aids -- This Page        Navigation Aids -- This Topic        Navigation Aids -- This Site








Review of Terms Related to This Topic





The Purpose for this Page

This page will show the basic rules for the JavaScript relational operator group. Some special situation cases are explained. And finally, some scripting examples are provided with comments.





The Basics of Relational Operator Group





Type conversions


Special Situations





Some Script Examples


Expression Giving Comment
"4" < "5" true less than
the ASCII equivalent of 4 (dec. 52) is less than 5 (dec. 53)
"43" < "5" true less than
strings are compared from left to right; 4 is less than 5
"b" < "a" false less than
the ASCII equivalent of "b" (dec. 98) is not less than "a" (dec. 97)
"B" < "a" true less than
the ASCII equivalent of "B" (dec. 66) is less than "a" (dec. 97)
"B".toLowerCase()
<
"a".toLowerCase()
false less than
the ASCII equivalent of "b" (dec. 98) is not less than "a" (dec. 97)
43 < 5 false less than
numbers have a numerical comparison; 43 is not less than 5
"B" < 5 false less than
the attempted conversion of "B" to a number would yield NaN; if either operand is NaN, the result of the operation is false
"0000001"
>=
"000001"
false greater than or equal
string comparison begins from left to right; these strings are not equal


Top            

Rx4AJAX        About Us | Topic Index | Contact Us | Privacy Policy | 2008 This Site Built By PPThompson