什么是JavaScript中的按位右移运算符(>>)?

左操作数的值向右移动右操作数指定的位数。

示例

您可以尝试运行以下代码以了解如何使用按位右移运算符-

<html>
   <body>
      <script>
         var a = 2; // Bit presentation 10
         var b = 3; // Bit presentation 11

         document.write("(a >> b) => ");
         result = (a >> b);
         document.write(result);
      </script>
   </body>
</html>