DEV Community

Discussion on: 4 Helpful Javascript Array tricks you should know

Collapse
 
jonrandy profile image
Jon Randy 🎖️ • Edited

Remove falsy values from an array:

arr.filter(x=>x)
Enter fullscreen mode Exit fullscreen mode

Why convert to a Boolean when JS is going to do that anyway? That's the whole point of truey/falsy values