Preview:
let str1="o";
let str2="a"

console.log(str1.localeCompare(str2))
//output is 1.
//because str2 pahale yetet according to alphabetical order
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter