how to compare strings lexicographically in javascript