Skip to content

nth() function

주어진 Iterable/AsyncIterable의 n번째 요소를 반환합니다.

Signature:

typescript
declare function nth(index: number, iterable: readonly []): undefined;

Example

ts
nth(2, [1, 2, 3, 4]); // 3
nth(5, [1, 2, 3, 4]); // undefined
nth(2, ["name", "gender", "age"]); // 'age'
nth(3, ["name", "gender", "age"]); // undefined
nth(2, "abcdefg"); // 'c'
nth(10, "abcdefg"); // undefined

Open Source Code

Released under the Apache-2.0 License.