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?
var data = [null, 1,2,3]; var r = data.filter(function(i){ return i != null; })
console.log(r)
[1,2,3]