I have a JS sort like this:
records.sort(function(a, b) {
if (a < b) return -1;
if (a > b) return 1;
return 0;
});
This works, but some of my records are ""
or null
.
The empty records are listed at the begin but I want them at the end.
I think there are better ways to do this than:
if (a == "") a = "zzzz";
But how can I do this?