Update unzip.md
This commit is contained in:
@ -3,7 +3,7 @@ title: unzip
|
||||
tags: array,intermediate
|
||||
---
|
||||
|
||||
Creates an array of arrays, ungrouping the elements in an array produced by [zip](#zip).
|
||||
Creates an array of arrays, ungrouping the elements in an array produced by [zip](/js/s/zip).
|
||||
|
||||
Use `Math.max.apply()` to get the longest subarray in the array, `Array.prototype.map()` to make each element an array.
|
||||
Use `Array.prototype.reduce()` and `Array.prototype.forEach()` to map grouped values to individual arrays.
|
||||
@ -21,4 +21,4 @@ const unzip = arr =>
|
||||
```js
|
||||
unzip([['a', 1, true], ['b', 2, false]]); // [['a', 'b'], [1, 2], [true, false]]
|
||||
unzip([['a', 1, true], ['b', 2]]); // [['a', 'b'], [1, 2], [true]]
|
||||
```
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user