Options
All
  • Public
  • Public/Protected
  • All
Menu
docs-hide-from-nav

Type parameters

  • T

Hierarchy

  • Array

Index

Methods

find

  • find(predicate: function, thisArg?: any): T
  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (value: T, index: number, obj: Array<T>): boolean
        • Parameters

          • value: T
          • index: number
          • obj: Array<T>

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns T

findIndex

  • findIndex(predicate: function, thisArg?: any): number
  • Returns the index of the first element in the array where predicate is true, and undefined otherwise.

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (value: T): boolean
        • Parameters

          • value: T

          Returns boolean

    • Optional thisArg: any

      If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

    Returns number

includes

  • includes(searchElement: T, fromIndex?: number): boolean
  • Determines whether an array includes a certain element, returning true or false as appropriate.

    Parameters

    • searchElement: T

      The element to search for.

    • Optional fromIndex: number

      The position in this array at which to begin searching for searchElement.

    Returns boolean