Code to go logo
Created using Figma
Use Cases
Contribute
How to apply function to every array element in JavaScript
Functions
By Jad Joubran ·
Last updated Dec 19, 2017
const ages = [18, 20, 21, 30]; const agesPlusOne = ages.map(age => age + 1);
[19, 21, 22, 31]
Dec 19, 2017
1
Jad Joubran
See answer
1
Jad Joubran
Array.map
on MDN
Learn JavaScript step by step