Answers for "math.map"

11

javascript map

function listFruits() {
  let fruits = ["apple", "cherry", "pear"]
  
  fruits.map((fruit, index) => {
    console.log(index, fruit)
  })
}

listFruits()

// https://jsfiddle.net/tmoreland/16qfpkgb/3/
Posted by: Guest on June-07-2020
1

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]
Posted by: Guest on December-02-2020
4

javascript map

The map() method creates a new array with the results of calling a provided function on every element in the calling array.
Posted by: Guest on December-22-2019

Code answers related to "Javascript"

Browse Popular Code Answers by Language