Table of contents Home page
Execute this code
// Operator precedence: 10 // Operator associativity: left-to-right var string1 = 'alpha' var string2 = 'Beta' // Note that JavaScript simply does a binary comparison of the characters, so the result may not be a correct // ordering according to the rules of a particular language! For example, "a" (lower case) comes after "B" // (upper case) because it has a greater Unicode character value. // Lexicographically correct ordering of letters is only guaranteed when all characters are ASCII characters and // the letters are not a mixture of lowercase or uppercase letters. if (string1 >= string2) { alert('"' + string1 + '" comes after or is equal to "' + string2 + '".') } else { alert('"' + string1 + '" comes before "' + string2 + '".') }