ie8不支持的数组方法
1、Array.map()
2、//添加数组IndexOf方法
就是在使用indexOf方法前,验证一下是否存在该方法IndexOf方法,如果有调用;如果没有就添加一个:
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (num) {
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0) ?
Math.ceil(from) :
Math.floor(from);
if (from < 0)
from += len;
for (; from < len; from++) {
if (from in this && this[from] === num)
return from;
}
return -1;
};
}
if(you love javascript) I'd like to be with your friends