let new_array = arr.map(function callback( currentValue[, index[, array]]) {
// return element for new_array
}[, thisArg])
const numbers = [1, 5, 10, 15];
const doubles = numbers.map(function(x) {
return x * 2;
});
// doubles is now [2, 10, 20, 30]
// numbers is still [1, 5, 10, 15]
function square(arr) {
const newArr = arr.map(x => x * x );
return newArr ;
//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
myRange = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//understanding map power is similar to forEach, but concise
//creating objects
const newRange = myRange.map((d) =>({num : d * 5, tuo : d * 50}));
//creating updated ranges
const newRange = myRange.map((d) =>d * 5);