localeCompare function

PHOTO EMBED

Wed Mar 15 2023 20:00:53 GMT+0000 (Coordinated Universal Time)

Saved by @bhushan03

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

console.log(str1.localeCompare(str2))
//output is 1.
//because str2 pahale yetet according to alphabetical order
content_copyCOPY

https://www.programiz.com/javascript/online-compiler/