Answers for "map and map array to new array javascript"

24

array map javascript

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 November-25-2019
0

javascript converting an array into a map

const arr = ['a', 'b', 'c', 2, 3, 4];
const nwMap = new Map([...arr.entries()]);
Posted by: Guest on July-12-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language