Files
30-seconds-of-code/test/unzip/unzip.js
2018-08-02 13:49:33 +03:00

9 lines
215 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;