Since using array.splice modifies the array in-place, how can I remove all whitespace-only elements from an array without throwing an error? With PHP we have preg_grep but I
Another filter based variation - reusable (function)
function removeWhiteSpaceFromArray(array){ return array.filter((item) => item != ' '); }