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, "B" (upper case) comes before "a" // (lower case) because it has a lower Unicode character value. // Lexicographically correct ordering 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 before or is equal to "' + string2 + '".') } else { alert('"' + string1 + '" comes after "' + string2 + '".') }