This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [{id:3,title:"Ali"},{id:3,title:"Veli"},{id:3,title:"Vehbi"}]; | |
arr.sort(turkcesiralama); | |
function turkcesiralama(a, b,aProp="title",bProp="title"){ | |
var atitle = a[aProp]; | |
var btitle = b[bProp]; | |
var alfabe = "AaBbCcÇçDdEeFfGgĞğHhIıİiJjKkLlMmNnOoÖöPpQqRrSsŞşTtUuÜüVvWwXxYyZz0123456789"; | |
if (atitle.length === 0 || btitle.length === 0) { | |
return atitle.length - btitle.length; | |
} |