Function pull

  • Removes all given values from array using SameValueZero for equality comparisons.

    Note: Unlike without, this method mutates array. Use remove to remove elements from an array by predicate.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to modify.

    • Rest ...values: T[]

      The values to remove.

      Rest

    Returns T[]

    Returns array.

    Since

    5.11.0

    See

    [[pullAll]], [[pullAllBy]], [[pullAllWith]], [[pullAt]], [[remove]], [[reject]]

    Example

    const array = ['a', 'b', 'c', 'a', 'b', 'c']

    pull(array, 'a', 'c')
    console.log(array)
    // => ['b', 'b']