<<是什么?和>>接线员呢? [英] What do the << and >> operator do?

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

问题描述

我遇到了如下所示的一些代码,并且对其工作感到困惑.

I came across some code as noted below and am confused as to what it's doing.

hash += (hash << 10);

推荐答案

它是按位运算符.

以下是MDN中的一个示例(链接到上面):

Here's an example from the MDN (linked to above):

     9 (base 10): 00000000000000000000000000001001 (base 2)
                  --------------------------------
9 << 2 (base 10): 00000000000000000000000000100100 (base 2) = 36 (base 10)

看看1的变化如何?

这篇关于&lt;&lt;是什么?和&gt;&gt;接线员呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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