<分区>
Possible Duplicate:
What good does zero-fill bit-shifting by 0 do? (a >>> 0)
我正在查看 array.indexOf()
,我知道 IE7 本身并不支持它。我正在阅读 MDC 并看到 their example of how to prototype it进入不支持它的浏览器。我正在通读它,试图了解一切是如何工作的,但我不确定我是否 100% 理解它。造成混淆的主要原因是按位运算符,特别是 >>>
。我不确定这个运算符有什么用。以下是他们使用它的方式。谁能准确解释它的用途以及为什么不能 if (t.length === 0)
?
var t = Object(this);
var len = t.length >>> 0;
if (len === 0)
return -1;