map for assigning each index value in array code example
Example 1: map index
array.map((currentelement, index) => {
});
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);