Array.prototype.map()
creates a new array. How can I use this new array within the callback function passed to Array.prototype.map()
?
For instance:
someArray.map(function(item, idx, arr) {
return { theCreatedArray: xyz };
});
What should I assign to xyz
in this scenario?
Additional Info [Context]
Why am I interested in doing this? The object I generate in the callback relies on accessing the referencing array, and restructuring this requirement seems challenging. As an alternative, I prefer to adhere to it.