Posted By: Anonymous
Binary search requires you to know whether the key is
== the pivot or
< the pivot.
C like languages which have the
strcmp() function that returns three values
(-1, 0, +1) for (less than, equal, greater than).
You can use the
string_a.localeCompare(string_b); /* Expected Returns: 0: exact match -1: string_a < string_b 1: string_a > string_b */
- MDN: String.prototype.localeCompare