- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Array map
JavaScript Arrays
JavaScript Array map
JavaScript
mapbuilds a new array by running a function on every element.
The new array always has the same length as the original.
The original array is never changed.
Example
Example
javascript
const numbers = [1, 2, 3];
console.log(numbers.map(n => n * 2).join(","));The output is 2,4,6.
