On this page
  1. Array.map
  2. Signature & Overview
  3. Notes & Pitfalls
  4. Example

Array.map

Prev: Array | Up: Array | Next: filter
Rel: Array, Array & Typed Arrays Guide
Ref: MDN Web Docs — Array.map
Tags: #public #web #javascript #builtins #array #tier/core


Signature & Overview

arr.map(fn(el, idx, arr))

Returns a new array with fn applied to every element without mutating arr.

Notes & Pitfalls

Example

const prices = [10, 20, 30];
const taxed = prices.map((p) => +(p * 1.1).toFixed(2));
console.assert(JSON.stringify(taxed) === "[11,22,33]");

Linked from

Related notes