@mirei/ts-collections
    Preparing search index...

    Function elementAt

    • Retrieves the element at the specified zero-based index.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      Parameters

      • source: Iterable<TElement>

        The source iterable.

      • index: number

        Zero-based position of the element to retrieve.

      Returns TElement

      The element located at the requested index.

      Thrown when index is negative or greater than or equal to the number of elements in source.

      Enumeration stops once the requested element is found; remaining elements are not evaluated.

      const numbers = [1, 2, 3, 4, 5];
      const element = elementAt(numbers, 2);
      console.log(element); // 3