Skip to content

array.Function.compact

soetas edited this page Nov 30, 2024 · 2 revisions

estdlib v0.1.2 / array / compact

Function: compact()

compact(array): void

Creates an array with all falsey values removed

Parameters

array: unknown[]

The array to compact

Returns

void

  • Returns the new array of filtered values

Since

0.1.2

See

source

Example

compact([0, 1, false, 2, '', 3])
// => [1, 2, 3]
Clone this wiki locally