String.localeCompare() 會依地區排序規則比較兩個字串。
var str = 'apple'; str.localeCompare('banana');
回傳值通常為負數、0 或正數,分別代表小於、等於或大於。
這個方法適合用於本地化排序與字典順序比較。