Function pullAt

  • Removes elements from array corresponding to indexes and returns an array of removed elements.

    Note: Unlike at, this method mutates array.

    Type Parameters

    • T

    Parameters

    • array: T[]

      The array to modify.

    • Optional Rest...indexes: number[]

      The indexes of elements to remove.

    Returns T[]

    Returns the new array of removed elements.

    3.0.0

    pull, pullAll, pullAllBy, pullAllWith, remove, reject

    const array = ['a', 'b', 'c', 'd']
    const pulled = pullAt(array, [1, 3])

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

    console.log(pulled)
    // => ['b', 'd']