ie在过去给我们添了很多坑。
1 if (!Array.prototype.indexOf) { 2 Array.prototype.indexOf = function(elt /*, from*/ ) { 3 var len = this.length >>> 0; 4 var from = Number(arguments[1]) || 0; 5 from = (from < 0) ? Math.ceil(from) : Math.floor(from); 6 if (from < 0) 7 from += len; 8 for (; from < len; from++) { 9 if (from in this && 10 this[from] === elt) 11 return from; 12 } 13 return -1; 14 }; 15 }
原文:http://www.cnblogs.com/lmaster/p/6273130.html