Encountering a problem with sorting contacts by first name, especially when some contacts are missing this information. Any suggestions on how to modify the method for such cases? Thanks!
This is the current sorting function I am using:
function sortAZ(ob1,ob2) {
var n1 = ob1.firstName.toLowerCase()
var n2 = ob2.firstName.toLowerCase()
if (n1 > n2) {return 1}
else if (n1 < n2){return -1}
else { return 0}//nothing to split
};
data.sort(sortAZ);