Update unzip.md

This commit is contained in:
Angelos Chalaris
2020-02-04 22:45:31 +02:00
committed by GitHub
parent cd9b447a3e
commit dec6c28029

View File

@ -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]]
```
```