Maps the given array with the given functions.

Type signature

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

Examples

map((x) => x * x)([1, 2, 3]);
// ⇒ [1, 4, 9]
Try in REPL
map(
  (x) => x * x,
  (x) => x + 1,
)([1, 2, 3]);
// ⇒ [2, 5, 10]
Try in REPL

Questions

  • How to map an array?

TypeScript sourceJavaScript source