compactArray
public
Returns a copy of the array with all null
and undefined
elements removed.
let arr = ['a', null, 'c', undefined]; arr.compact(); // ['a', 'c']
Returns:
-
Array
- the array without null and undefined elements.
compactArray
public
Returns a copy of the array with all null
and undefined
elements removed.
let arr = ['a', null, 'c', undefined]; arr.compact(); // ['a', 'c']
Array
Please login to continue.