map() - Transform Elements in JavaScript
From the JavaScript Array Methods cheat sheet ยท Transformation Methods ยท verified Jul 2026
map() - Transform Elements
Create a new array by transforming each element
javascript
// Create new array by transforming each element
const doubled = [1, 2, 3].map(x => x * 2);
// [2, 4, 6]
const users = [{name: 'John', age: 30}];
const names = users.map(u => u.name);
// ['John']
// With index
const indexed = ['a', 'b'].map((val, i) => `${i}: ${val}`);
// ['0: a', '1: b']๐ข Essential - Most commonly used array method
๐ก Returns new array, doesn't modify original
โก Perfect for data transformation and React rendering
๐ Always returns array of same length as original
๐ Related: forEach (for side effects), filter (for selection)