New answers tagged

0

How about this? You iterate through each array only once. function zipLongest(...arrays: Array<any>) { const result:any[] = []; arrays.forEach((arr) => { arr.forEach((val: any, i: number) => { if (i === result.length) result.push([]); result[i].push(val); }) }); return result; } "use strict"; ...


Top 50 recent answers are included