JS sort() empty to end
Shorter way:
['a', '!', 'z','Z', null, undefined, '']
.sort((a, b) => !a ? 1 : (!b ? -1 : (a.localeCompare(b))) )
records.sort((a,b) => a ? b ? a.localeCompare(b) : -1 : 1);
A ES6 one-liner version of Eric Hotinger's answer
Maybe something like this:
records.sort(function(a, b) {
if(a === "" || a === null) return 1;
if(b === "" || b === null) return -1;
if(a === b) return 0;
return a < b ? -1 : 1;
});