DEV Community

Discussion on: 1 line of code: How to clean an Array

Collapse
 
martinkr profile image
Martin Krause

Hi Damjan,

thank you for the suggestion. Indeed, this function should preserve 0 and false. Array.filter(Boolean) will be another oneliner which removes everything that is considered "false".
Cheers!