Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

map javascript

// use the map method on an array.

// define array
let scores = [10, 25, 30]

// use of map, we store the map method in to a variable called doubledScore
let doubledScore = scores.map(function(score) {
	return score * 2 // returns every value of the array * 2 
})


console.log(doubledScore) // [20, 50, 60]
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #map #javascript
ADD COMMENT
Topic
Name
9+5 =