Added some tests
Also fixed xProd. Tests for xProd, unzipWith, unzip and is.
This commit is contained in:
@ -2,10 +2,10 @@
|
||||
|
||||
Creates a new array out of the two supplied by creating each possible pair from the arrays.
|
||||
|
||||
Use `Array.map()` to produce every possible pair from the elements of the two arrays.
|
||||
Use `Array.reduce()`, `Array.map()` and `Array.concat()` to produce every possible pair from the elements of the two arrays and save them in an array.
|
||||
|
||||
```js
|
||||
const xProd = (a, b) => a.map(x => b.map(y => [x, y]));
|
||||
const xProd = (a, b) => a.reduce((acc,x) => acc.concat(b.map(y => [x, y])),[]);
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user