gpt4 book ai didi

javascript ->>>(补零右移)详解

转载 作者:数据小太阳 更新时间:2023-10-29 06:08:50 29 4
gpt4 key购买 nike

<分区>

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;

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com