The arrayRemove function removes elements from an array based on a specified predicate function and returns the removed elements.

  • Type Parameters

    • T

    Parameters

    • array: T[]

      An array of elements that you want to filter based on the provided predicate function.

    • predicate: ((item: T, index: number, array: T[]) => boolean)

      The predicate parameter is a function that takes three arguments:

        • (item, index, array): boolean
        • Parameters

          • item: T
          • index: number
          • array: T[]

          Returns boolean

    Returns T[]

    The arrayRemove function returns an array containing the elements that satisfy the given predicate function.