map syntax java script code example
Example 1: javascript map
const numbers = [0,1,2,3];
console.log(numbers.map((number) => {
return number;
}));
Example 2: array map
let A = [{ x:'x', y:'y' }, { x:'x', y:'y' }];
let result = A.map(({y,...rest})=> ({...rest,v:y}));
console.log(result);