update snippets 1-15

This commit is contained in:
Stefan Feješ
2017-12-25 13:59:23 +01:00
parent c9f570e8f9
commit 5e1b9b2b7d
15 changed files with 67 additions and 26 deletions

View File

@ -9,5 +9,8 @@ If the original array can't be split evenly, the final chunk will contain the re
```js
const chunk = (arr, size) =>
Array.from({length: Math.ceil(arr.length / size)}, (v, i) => arr.slice(i * size, i * size + size));
// chunk([1,2,3,4,5], 2) -> [[1,2],[3,4],[5]]
```
```js
chunk([1,2,3,4,5], 2) -> [[1,2],[3,4],[5]]
```