Array.prototype.mapping = function(callback, arr, args) {
const result = [];
for (let i = 0; i < arr.length; i++) {
result.push(callback.call(args, arr[i], i, arr));
}
return result;
}
let arr = [1, 2, 3];
arr.mapping(function(item, index){
console.log(item, index);
})
Array.prototype.mapping = function(callback) {
const arrayToReturn = [];
for (let index = 0; index < this.length; index++) {
arrayToReturn.push(callback(this[index], index, this));
}
return arrayToReturn;
}