Function compact

  • Return a copy of the array with the null values removed

    Parameters

    • arr: any[]

    Returns any[]

    Function

    Example

    compact(["a", "b", null, "c"]) // => ["a", "b", "c"]