1 //添加数组IndexOf方法
 2 //整理 jquery中文网
 3 if (!Array.prototype.indexOf)
 4 {
 5   Array.prototype.indexOf = function(elt /*, from*/)
 6   {
 7     var len = this.length >>> 0;
 8     var from = Number(arguments[1]) || 0;
 9     from = (from < 0)
10          ? Math.ceil(from)
11          : Math.floor(from);
12     if (from < 0)
13       from += len;
14     for (; from < len; from++)
15     {
16       if (from in this &&
17           this[from] === elt)
18         return from;
19     }
20     return -1;
21   };
22 }

 

相关文章:

  • 2021-09-16
  • 2021-07-25
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-21
  • 2022-12-23
  • 2021-06-13
  • 2021-10-12
相关资源
相似解决方案