update snippets 32-47
This commit is contained in:
committed by
Agamemnon Zorbas
parent
014a77224c
commit
1c73c70b4a
@ -6,5 +6,8 @@ Use `Array.filter()` to create a new array that contains every nth element of a
|
||||
|
||||
```js
|
||||
const everyNth = (arr, nth) => arr.filter((e, i) => i % nth === nth - 1);
|
||||
// everyNth([1,2,3,4,5,6], 2) -> [ 2, 4, 6 ]
|
||||
```
|
||||
|
||||
```js
|
||||
everyNth([1,2,3,4,5,6], 2) -> [ 2, 4, 6 ]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user