06-tagstag hover×7all
function 
function compact(arr: (string | null)[]): (string | null)[]
compact
(
(parameter) arr: (string | null)[]
arr
: (string | null)[]) {
compacts falsy values out of an array
return
(parameter) arr: (string | null)[]
arr
.
(method) Array<string | null>.filter(predicate: (value: string | null, index: number, array: (string | null)[]) => unknown, thisArg?: any): (string | null)[] (+1 overload)

Returns the elements of an array that meet the condition specified in a callback function.

@parampredicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.@paramthisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
filter
(
var Boolean: BooleanConstructor
Boolean
)
} const
const kept: (string | null)[]
kept
=
function compact(arr: (string | null)[]): (string | null)[]
compact
(["a", null, "b"])