什么是>>>操作员? [英] What's the >>> operator?

查看:130
本文介绍了什么是>>>操作员?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mozilla网站的filter文档页面中,我看到了>>>运算符:

In filter documentation page in Mozilla website, I saw >>> operator:

var t = Object(this),
     len = t.length >>> 0, //here
     res, thisp, i, val;
if (typeof fun !== 'function') {
    throw new TypeError();
}

在这里您可以找到完整的文档: https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

Here you can find the complete document: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

这个运算符是什么及其作用?

What's this operator and what it does?

推荐答案

这是一个移位运算符.

来自 https://developer.mozilla.org/en -US/docs/Web/JavaScript/Guide/Expressions_and_Operators

a >>> b将二进制表示形式的a右移b位,丢弃偏移的位,并从左移零.

a >>> b shifts a in binary representation b bits to the right, discarding bits shifted off, and shifting in zeros from the left.

但是,这并不能解释为什么有人会不愿意将值右移零位.您也可以将其乘以1或加零.

That doesn't explain why anyone would bother to shift a value zero bits to the right, though. You might as well multiply it by one, or add zero.

这篇关于什么是>>>操作员?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆