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, and since the Unicode character value // of "B" is less than that of "a", "Beta" comes before "alpha"! // 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 before "' + string2 + '".') } else { alert('"' + string1 + '" does not come before "' + string2 + '".') }