Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mdn .map

const numbers = [1, 5, 10, 15];
const doubles = numbers.map(function(x) {
   return x * 2;
});
// doubles is now [2, 10, 20, 30]
// numbers is still [1, 5, 10, 15]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #mdn
ADD COMMENT
Topic
Name
4+2 =