js remove falsey values from array

Solutions on MaxInterview for js remove falsey values from array by the best coders in the world

showing results for - "js remove falsey values from array"
Noah
24 Mar 2019
1const a =[3,,null, false, undefined, 1];
2
3// Remove falsey
4a.filter(Boolean);
5 
6// Remove specific (undefined)
7a.filter(e => e !== undefined);