instance method Array#compact
Array#compact() → Array
Returns a copy of the array without any null
or undefined
values.
Example
var orig = [undefined, 'A', undefined, 'B', null, 'C'];
var copy = orig.compact();
// orig -> [undefined, 'A', undefined, 'B', null, 'C'];
// copy -> ['A', 'B', 'C'];