Function arrIndicesOf

  • Returns all indexes at which an element is found.

    Type Parameters

    • T

      The type of elements in the input array.

    Parameters

    • input: T[]

      The array to search

    • element: T

      The element to find

    Returns number[]

    An array of indices where the specified element can be found.

    Example

     const inputArray = [1, 2, 3, 2, 4, 2, 5];
    const elementToFind = 2;
    arrIndicesOf(inputArray, elementToFind);
    //=> [1, 3, 5]

Generated using TypeDoc