Options
All
  • Public
  • Public/Protected
  • All
Menu

Module array/indexOf

Index

References

Functions

References

Renames and re-exports indexOf

Functions

  • indexOf(target: string, list: string): number
  • indexOf<T>(target: T, list: ArrayLike<T>): number
  • indexOf(targer: string): (list: string) => number
  • indexOf<T>(target: T): (list: ArrayLike<T>) => number
  • Returns the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.

    example
     indexOf(3, [1,2,3,4]); //=> 2
    indexOf(10, [1,2,3,4]); //=> -1

    Parameters

    • target: string

      The item to find.

    • list: string

    Returns number

    the index of the target, or -1 if the target is not found.

  • Returns the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.

    example
     indexOf(3, [1,2,3,4]); //=> 2
    indexOf(10, [1,2,3,4]); //=> -1

    Type parameters

    • T

    Parameters

    • target: T

      The item to find.

    • list: ArrayLike<T>

    Returns number

    the index of the target, or -1 if the target is not found.

  • Returns the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.

    example
     indexOf(3, [1,2,3,4]); //=> 2
    indexOf(10, [1,2,3,4]); //=> -1

    Parameters

    • targer: string

    Returns (list: string) => number

    the index of the target, or -1 if the target is not found.

      • (list: string): number
      • Parameters

        • list: string

        Returns number

  • Returns the position of the first occurrence of an item in an array, or -1 if the item is not included in the array.

    example
     indexOf(3, [1,2,3,4]); //=> 2
    indexOf(10, [1,2,3,4]); //=> -1

    Type parameters

    • T

    Parameters

    • target: T

      The item to find.

    Returns (list: ArrayLike<T>) => number

    the index of the target, or -1 if the target is not found.

      • (list: ArrayLike<T>): number
      • Parameters

        • list: ArrayLike<T>

        Returns number

Generated using TypeDoc