Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js remove falsey values from array

const a =[3,,null, false, undefined, 1];

// Remove falsey
a.filter(Boolean);
 
// Remove specific (undefined)
a.filter(e => e !== undefined);
 
PREVIOUS NEXT
Tagged: #js #remove #falsey #values #array
ADD COMMENT
Topic
Name
9+4 =