Function sortedIndexOf

  • This method is like indexOf except that it performs a binary search on a sorted array.

    Parameters

    • array: any[]

      The array to inspect.

    • value: any

      The value to search for.

    Returns number

    Returns the index of the matched value, else -1.

    4.0.0

    sortedIndexOf([4, 5, 5, 5, 6], 5)
    // => 1