Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

map javascript

var numbers = [1, 4, 9];
var doubles = numbers.map(function(num) {
  return num * 2;
});
// doubles is now [2, 8, 18]. numbers still [1, 4, 9]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #map #javascript
ADD COMMENT
Topic
Name
2+3 =