Removes falsey values (false, null, 0, 0n, '', undefined, NaN) from an array.
The type of elements in the array.
The input array to remove falsey values.
compact([0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);Returns: [1, 2, 3, 4, 5] Copy
compact([0, 0n, 1, false, 2, '', 3, null, undefined, 4, NaN, 5]);Returns: [1, 2, 3, 4, 5]
Alias