How to right map function
Dec 23, 2020
Syntax
let newArray = arr.map(callback(currentValue[, index[, array]]) {
// return element for newArray, after executing something
}[, thisArg]);
Example
const arr = [1,2,5,6,10,20];
// pass a function to map
const map1 = arr.map(x => x + 2);
// x is value of each element of arr
console.log(map1);
// expected output: Array [3, 4, 7, 8,12,22]
Thankyou for reaD