I need to sort an array of strings, but I need it so that null is always last. For example, the array:
var arr = [a, b, null, d, null]
When
like this, note: this will only push the null's to the back
var arr = ["a", null, "b"]; var arrSor = []; arr.forEach(function (el) { if (el === null) { arrSor.push(el); } else { arrSor.unshift(el); } });