Files
30-seconds-of-code/test/unzip/unzip.js
2018-02-04 17:38:39 +02:00

8 lines
192 B
JavaScript

const unzip = arr =>
arr.reduce(
(acc, val) => (val.forEach((v, i) => acc[i].push(v)), acc),
Array.from({
length: Math.max(...arr.map(x => x.length))
}).map(x => [])
);
module.exports = unzip;