aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/operators/right_shift_assignment
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/javascript/reference/operators/right_shift_assignment')
-rw-r--r--files/zh-cn/web/javascript/reference/operators/right_shift_assignment/index.md66
1 files changed, 29 insertions, 37 deletions
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
---
-<div>{{jsSidebar("Operators")}}</div>
+{{jsSidebar("Operators")}}
-<p>The right shift assignment operator (<code>&gt;&gt;=</code>) moves the specified amount of bits to the right and assigns the result to the variable.</p>
+右移赋值运算符 (`>>=`) 将变量向右移动指定数量的位,并将结果赋值给变量。
-<div>{{EmbedInteractiveExample("pages/js/expressions-right-shift-assignment.html")}}</div>
+{{EmbedInteractiveExample("pages/js/expressions-right-shift-assignment.html")}}
+## 语法
+```js
+x >>= y // x = x >> y
+```
+## 例子
+### 使用右移赋值运算符
-<h2 id="语法">语法</h2>
-
-<pre class="syntaxbox"><strong>Operator:</strong> x &gt;&gt;= y
-<strong>Meaning:</strong> x = x &gt;&gt; y</pre>
-
-<h2 id="Examples">Examples</h2>
-
-<h3 id="Using_right_shift_assignment">Using right shift assignment</h3>
-
-<pre class="brush: js">let a = 5; // (00000000000000000000000000000101)
-a &gt;&gt;= 2; // 1 (00000000000000000000000000000001)
+```js
+let a = 5; // (00000000000000000000000000000101)
+a >>= 2; // 1 (00000000000000000000000000000001)
let b = -5; // (-00000000000000000000000000000101)
-b &gt;&gt;= 2; // -2 (-00000000000000000000000000000010)</pre>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- </tr>
- <tr>
- <td>{{SpecName('ESDraft', '#sec-assignment-operators', 'Assignment operators')}}</td>
- </tr>
- </tbody>
-</table>
+b >>= 2; // -2 (-00000000000000000000000000000010)
+```
-<h2 id="Browser_compatibility">Browser compatibility</h2>
+## 规范
+{{Specifications}}
+## 浏览器兼容性
-<p>{{Compat("javascript.operators.right_shift_assignment")}}</p>
+{{Compat}}
-<h2 id="See_also">See also</h2>
+## 参考
-<ul>
- <li><a href="/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Assignment">Assignment operators in the JS guide</a></li>
- <li><a href="/en-US/docs/Web/JavaScript/Reference/Operators/Right_shift">Right shift operator</a></li>
-</ul>
+- [JS 指南中的赋值运算符](/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#assignment)
+- [右移运算符](/zh-CN/docs/Web/JavaScript/Reference/Operators/Right_shift)