From 42c588ef3ded2d0cc2f4a71d5d5f90a2c66e534e Mon Sep 17 00:00:00 2001 From: catlair Date: Thu, 10 Mar 2022 18:47:50 +0800 Subject: 与英文版同步并翻译为 zh-CN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operators/right_shift_assignment/index.md | 66 ++++++++++------------ 1 file changed, 29 insertions(+), 37 deletions(-) (limited to 'files/zh-cn/web/javascript/reference/operators/right_shift_assignment') diff --git a/files/zh-cn/web/javascript/reference/operators/right_shift_assignment/index.md b/files/zh-cn/web/javascript/reference/operators/right_shift_assignment/index.md index f3698e9737..7afdf1311e 100644 --- a/files/zh-cn/web/javascript/reference/operators/right_shift_assignment/index.md +++ b/files/zh-cn/web/javascript/reference/operators/right_shift_assignment/index.md @@ -1,55 +1,47 @@ --- -title: Right shift assignment (>>=) +title: 右移赋值 (>>=) slug: Web/JavaScript/Reference/Operators/Right_shift_assignment -translation_of: Web/JavaScript/Reference/Operators/Right_shift_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.right_shift_assignment --- -
{{jsSidebar("Operators")}}
+{{jsSidebar("Operators")}} -

The right shift assignment operator (>>=) moves the specified amount of bits to the right and assigns the result to the variable.

+右移赋值运算符 (`>>=`) 将变量向右移动指定数量的位,并将结果赋值给变量。 -
{{EmbedInteractiveExample("pages/js/expressions-right-shift-assignment.html")}}
+{{EmbedInteractiveExample("pages/js/expressions-right-shift-assignment.html")}} +## 语法 +```js +x >>= y // x = x >> y +``` +## 例子 +### 使用右移赋值运算符 -

语法

- -
Operator: x >>= y
-Meaning:  x   = x >> y
- -

Examples

- -

Using right shift assignment

- -
let a = 5; //   (00000000000000000000000000000101)
-a >>= 2;   // 1 (00000000000000000000000000000001)
+```js
+let a = 5; //   (00000000000000000000000000000101)
+a >>= 2;   // 1 (00000000000000000000000000000001)
 
 let b = -5; //  (-00000000000000000000000000000101)
-b >>= 2;  // -2 (-00000000000000000000000000000010)
- -

Specifications

- - - - - - - - - - -
Specification
{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}}
+b >>= 2; // -2 (-00000000000000000000000000000010) +``` -

Browser compatibility

+## 规范 +{{Specifications}} +## 浏览器兼容性 -

{{Compat("javascript.operators.right_shift_assignment")}}

+{{Compat}} -

See also

+## 参考 - +- [JS 指南中的赋值运算符](/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#assignment) +- [右移运算符](/zh-CN/docs/Web/JavaScript/Reference/Operators/Right_shift) -- cgit v1.2.3-54-g00ecf