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 "a" is greater than that of "B", "alpha" comes after "Beta"! // 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 "' + string2 + '".') } else { alert('"' + string1 + '" does not come after "' + string2 + '".') }