It simply not works. You can call Array.map only on Objects that have numerical properties starting with 0 and have a corresponding length property. So only this will work:
var xargByID = {0: 'first', 1: 'second', 2: 'third', length: 3};
Array.prototype.map.bind(xargByID)(function (xarg) {
console.log(xarg);
});
It's because .map() internally does something like the following simulation:
function simulateMap(callback, thisArg) {
var ret = [], length = this.length, that = thisArg || this;
for (var i = 0; i < length; i++) {
ret.push(callback.call(that, this[i], i, this));
}
return ret;
}
It's the same with .forEach(), .some(), and so on.
EDIT But if you like .map() so much you can do:
var xargByID = { a: 1, b: 2, c: 3};
Object.getOwnPropertyNames(xargByID).map(function(xarg, i, arr) {
console.log(xarg, arr[i]);
});