Zips the given arrays together with the given function.

Type signature

(
  f?: (x: any, y: any) => any[]
) => (xs: any[], ys: any[]) => any[][]

Examples

zipWith((x, y) => x * x + y)(
  [1, 2, 3],
  [4, 5, 6]
);
// ⇒ [5, 9, 15]
Try in REPL

Questions

  • How to zip two arrays with a given function?

TypeScript sourceJavaScript source