Skip to content

compare

Signature

compare(string, string)

Description

Compares two strings lexicographically.

Examples

compare('a', 'a') == `0`
compare('a', 'b') == `-1`
compare('b', 'a') == `1`