diff options
author | catlair <catlair@qq.com> | 2022-03-10 18:47:50 +0800 |
---|---|---|
committer | Irvin <irvinfly@gmail.com> | 2022-03-15 21:36:59 +0800 |
commit | 42c588ef3ded2d0cc2f4a71d5d5f90a2c66e534e (patch) | |
tree | 77011a149d6dab2c49864c170528b6a92bff96d5 /files/zh-cn/web/javascript/reference/operators/left_shift_assignment | |
parent | 283c65cafc545c37b57ed0493b5c5e053ecbbb92 (diff) | |
download | translated-content-42c588ef3ded2d0cc2f4a71d5d5f90a2c66e534e.tar.gz translated-content-42c588ef3ded2d0cc2f4a71d5d5f90a2c66e534e.tar.bz2 translated-content-42c588ef3ded2d0cc2f4a71d5d5f90a2c66e534e.zip |
与英文版同步并翻译为 zh-CN
Diffstat (limited to 'files/zh-cn/web/javascript/reference/operators/left_shift_assignment')
-rw-r--r-- | files/zh-cn/web/javascript/reference/operators/left_shift_assignment/index.md | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/files/zh-cn/web/javascript/reference/operators/left_shift_assignment/index.md b/files/zh-cn/web/javascript/reference/operators/left_shift_assignment/index.md index 4499d3473c..af5ca56da0 100644 --- a/files/zh-cn/web/javascript/reference/operators/left_shift_assignment/index.md +++ b/files/zh-cn/web/javascript/reference/operators/left_shift_assignment/index.md @@ -1,55 +1,47 @@ --- -title: Left shift assignment (<<=) +title: 左移赋值 (<<=) slug: Web/JavaScript/Reference/Operators/Left_shift_assignment -translation_of: Web/JavaScript/Reference/Operators/Left_shift_assignment +tags: + - Assignment operator + - JavaScript + - Language feature + - Operator + - Reference +browser-compat: javascript.operators.left_shift_assignment --- -<div>{{jsSidebar("Operators")}}</div> +{{jsSidebar("Operators")}} -<p>The left shift assignment operator (<code><<=</code>) moves the specified amount of bits to the left and assigns the result to the variable.</p> +左移赋值运算符 (`<<=`) 将变量向左移动指定数量的位,并将结果赋值给变量。 -<div>{{EmbedInteractiveExample("pages/js/expressions-left-shift-assignment.html")}}</div> +{{EmbedInteractiveExample("pages/js/expressions-left-shift-assignment.html")}} +## 语法 +```js +x <<= y // x = x << y +``` +## 例子 +### 使用左移赋值 -<h2 id="语法">语法</h2> - -<pre class="syntaxbox"><strong>Operator:</strong> x <<= y -<strong>Meaning:</strong> x = x << y</pre> - -<h2 id="Examples">Examples</h2> - -<h3 id="Using_left_shift_assignment">Using left shift assignment</h3> - -<pre class="brush: js">let a = 5; +```js +let a = 5; // 00000000000000000000000000000101 -a <<= 2; // 20 -// 00000000000000000000000000010100</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> +a <<= 2; // 20 +// 00000000000000000000000000010100 +``` -<h2 id="Browser_compatibility">Browser compatibility</h2> +## 规范 +{{Specifications}} +## 浏览器兼容性 -<p>{{Compat("javascript.operators.left_shift_assignment")}}</p> +{{Compat("javascript.operators.left_shift_assignment")}} -<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/Left_shift">Left shift operator</a></li> -</ul> +- [JS 指南中的赋值运算符](/zh-CN/docs/Web/JavaScript/Guide/Expressions_and_Operators#assignment) +- [左移运算符](/zh-CN/docs/Web/JavaScript/Reference/Operators/Left_shift) |