if (!Array.prototype.map) {
Array.prototype.map = function (fn, scope) {
var tmp = [];
for (var i = 0, len = this.length; i < len; ++i) {
tmp.push(fn.call(scope, this[i], i, this));
}
return tmp;
}
}
var arr = [1, 2, 3];
var arr1 = ["a", "b", "c"];
var mas = arr1.map.call(arr, function (el) {
return el;
});
alert(mas);
var sas = arr.map(function (el) {
return ++el;
});
alert(sas);