update snippets 78 - 96

This commit is contained in:
Stefan Feješ
2017-12-25 14:33:49 +01:00
parent 55bc1ec632
commit bc58a5bf54
18 changed files with 86 additions and 39 deletions

View File

@ -7,5 +7,8 @@ Use `Array.reduce()` combined with `Array.map()` to iterate over elements and co
```js
const powerset = arr =>
arr.reduce((a, v) => a.concat(a.map(r => [v].concat(r))), [[]]);
// powerset([1,2]) -> [[], [1], [2], [2,1]]
```
```js
powerset([1,2]) -> [[], [1], [2], [2,1]]
```