Zips the given arrays together into pairs.

Type signature

<T>(...xs: T[][]) => T[][]

Examples

zipN([1, 2, 3], [4, 5, 6]);
// ⇒ [[1, 4], [2, 5], [3, 6]]
Try in REPL
zipN(
  [1, 2, 3],
  [4, 5, 6],
  [7, 8, 9],
);
// ⇒ [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
Try in REPL
zipN([1, 2], [4, 5, 6], [7, 8, 9]);
// ⇒ [[1, 4, 7],[2, 5, 8]]
Try in REPL

Questions

  • How to zip multiple arrays?

TypeScript sourceJavaScript source