|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
848 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Finds the index of the first occurrence of a value in an array.
|
|---|
| 3 | *
|
|---|
| 4 | * This method is similar to `Array.prototype.indexOf`, but it also finds `NaN` values.
|
|---|
| 5 | * It uses strict equality (`===`) to compare elements.
|
|---|
| 6 | *
|
|---|
| 7 | * @template T - The type of elements in the array.
|
|---|
| 8 | * @param {ArrayLike<T> | null | undefined} array - The array to search.
|
|---|
| 9 | * @param {T} searchElement - The value to search for.
|
|---|
| 10 | * @param {number} [fromIndex] - The index to start the search at.
|
|---|
| 11 | * @returns {number} The index (zero-based) of the first occurrence of the value in the array, or `-1` if the value is not found.
|
|---|
| 12 | *
|
|---|
| 13 | * @example
|
|---|
| 14 | * const array = [1, 2, 3, NaN];
|
|---|
| 15 | * indexOf(array, 3); // => 2
|
|---|
| 16 | * indexOf(array, NaN); // => 3
|
|---|
| 17 | */
|
|---|
| 18 | declare function indexOf<T>(array: ArrayLike<T> | null | undefined, searchElement: T, fromIndex?: number): number;
|
|---|
| 19 |
|
|---|
| 20 | export { indexOf };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.