Answers for "map function node.js"

11

array map

const array1 = [1, 4, 9, 16];

// pass a function to map
const map1 = array1.map(x => x * 2);

console.log(map1);
// expected output: Array [2, 8, 18, 32]
Posted by: Guest on December-22-2019
4

array mdn map

let new_array = arr.map(function callback( currentValue[, index[, array]]) {
    // return element for new_array
}[, thisArg])
Posted by: Guest on June-15-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