Is it somehow possible to iterate an array in JS using Array.map() and modify the index values of the resulting array?
// I start with this values:
var arrSource = [
{id:7, name:"item 1"},
{id:10, name:"item 2"},
{id:19, name:"item 3"},
];
var arrResult = arrSource.map(function(obj, index) {
// What to do here?
return ???;
});
/*
This is what I want to get as result of the .map() call:
arrResult == [
7: {id:7, name:"item 1"},
10: {id:10, name:"item 2"},
19: {id:19, name:"item 3"},
];
*/