You can use the localeCompare() method.
string_a.localeCompare(string_b);
/* Expected Returns:
0: exact match
-1: string_a < string_b 1: string_a > string_b
*/
Further Reading:
MDN: String.prototype.localeCompare
Stack Overflow – Is there a JavaScript strcmp()?
Tutorials Point: JavaScript String – localeCompare() Method
Well in JavaScript you can check two strings for values same as integers so yo can do this:
“A” < "B" "A" == "B" "A" > “B”
And therefore you can make your own function that checks strings the same way as the strcmp().
So this would be the function that does the same:
function strcmp(a, b)
{
return (ab?1:0));
}