source: node_modules/es-toolkit/dist/compat/array/nth.d.ts@ a762898

Last change on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 501 bytes
Line 
1/**
2 * Gets the element at index `n` of `array`. If `n` is negative, the nth element from the end is returned.
3 *
4 * @param {ArrayLike<T> | null | undefined} array - The array to query.
5 * @param {number} [n=0] - The index of the element to return.
6 * @return {T | undefined} Returns the nth element of `array`.
7 *
8 * @example
9 * nth([1, 2, 3], 1); // => 2
10 * nth([1, 2, 3], -1); // => 3
11 */
12declare function nth<T>(array: ArrayLike<T> | null | undefined, n?: number): T | undefined;
13
14export { nth };
Note: See TracBrowser for help on using the repository browser.