How do I remove empty elements from an array in JavaScript?
Is there a straightforward way, or do I need to loop through it and remove them manually?
foo = [0, 1, 2, "", , false, 3, "four", null] foo.filter(function(e) { return e === 0 ? '0' : e })
returns
[0, 1, 2, 3, "four"]