这是Mozilla的Array.prototype.indexOf中的Mozilla代码
if (!Array.prototype.indexOf)
{
Array.prototype.indexOf = function(elt)
{
var len = this.length >>> 0; // What does ">>>" do?
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] === elt)return from;
}
return -1;
};
}
Run Code Online (Sandbox Code Playgroud)
我不明白一些语法.
">>>"在上面的代码中做了什么?
| 归档时间: |
|
| 查看次数: |
603 次 |
| 最近记录: |