You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
308 B
15 lines
308 B
4 years ago
|
# `nth()`
|
||
|
|
||
|
The nth method creates a new collection consisting of every n-th element:
|
||
|
|
||
|
```js
|
||
|
const collection = collect(['a', 'b', 'c', 'd', 'e', 'f']);
|
||
|
|
||
|
const nth = collection.nth(4);
|
||
|
|
||
|
nth.all();
|
||
|
|
||
|
// ['a', 'e']
|
||
|
```
|
||
|
|
||
|
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/nth.js)
|