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?
arraysjavascript
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?
Best Answer
Simple ways:
or - (only for single array items of type "text")
or - Classic way: simple iteration
via jQuery:
UPDATE - just another fast, cool way (using ES6):
Remove empty values