Note: I have done almose
var newArray = [];
var arr=[1, 2, 3];
function map(arr, callback) { // arr=[1, 2, 3], callback=function (x) { return x + 1; }
arr.forEach(function(index,value,arr){
newArray[value] = index + 1;
}
);
console.log(newArray);
}