Answers for "what does map((_, i) do?"

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
-2

is maps used in js

console.log(typeof(userRoles)); // object
console.log(userRoles instanceof Map); // true
Posted by: Guest on December-18-2020

Browse Popular Code Answers by Language