|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
644 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Retrieves elements from an array at the specified indices.
|
|---|
| 3 | *
|
|---|
| 4 | * This function supports negative indices, which count from the end of the array.
|
|---|
| 5 | *
|
|---|
| 6 | * @template T
|
|---|
| 7 | * @param {readonly T[]} arr - The array to retrieve elements from.
|
|---|
| 8 | * @param {number[]} indices - An array of indices specifying the positions of elements to retrieve.
|
|---|
| 9 | * @returns {T[]} A new array containing the elements at the specified indices.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * const numbers = [10, 20, 30, 40, 50];
|
|---|
| 13 | * const result = at(numbers, [1, 3, 4]);
|
|---|
| 14 | * console.log(result); // [20, 40, 50]
|
|---|
| 15 | */
|
|---|
| 16 | declare function at<T>(arr: readonly T[], indices: number[]): T[];
|
|---|
| 17 |
|
|---|
| 18 | export { at };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.