> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/web/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/web/js/grammar/op/assign.md).

# assignment

[JS](/web/js.md) ⟩ [operator](/web/js/grammar/op.md) ⟩ assignment

{% hint style="info" %}
an [operator](/web/js/grammar/op.md) for <mark style="color:yellow;">**arithmetic**</mark>/<mark style="color:yellow;">**bitwise**</mark>/<mark style="color:yellow;">**logical**</mark> assignment.
{% endhint %}

{% tabs %}
{% tab title="⭐️ 重點" %}
{% hint style="warning" %}
[const](/web/js/variable/declare/const.md) <mark style="color:red;">**can't**</mark>**&#x20;**<mark style="color:yellow;">**be changed**</mark> through <mark style="color:yellow;">**reassignment**</mark> (by using the [assignment](/web/js/grammar/op/assign.md) operators)
{% endhint %}
{% endtab %}

{% tab title="🔴 主題" %}

* types of assignment operators
  * [assignment (=)](/web/js/grammar/op/assign/assignment.md) operator
  * <mark style="color:yellow;">**assignment with operation**</mark>
    * [`*=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Multiplication_assignment) multiplication assignment.

      [`**=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Exponentiation_assignment) exponentiation assignment.

      [`/=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Division_assignment) division assignment.

      [`%=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Remainder_assignment) remainder assignment.

      [`+=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition_assignment) addition assignment.

      [`-=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Subtraction_assignment) subtraction assignment
    * [`<<=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Left_shift_assignment) left shift assignment.

      [`>>=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Right_shift_assignment) right shift assignment.

      [`>>>=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Unsigned_right_shift_assignment) unsigned right shift assignment.

      [`&=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_AND_assignment) bitwise AND assignment.

      [`^=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_XOR_assignment) bitwise XOR assignment.

      [`|=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_OR_assignment) bitwise OR assignment.
    * [`&&=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_AND_assignment) logical AND assignment.

      [`||=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_OR_assignment) logical OR assignment.

      [`??=`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Logical_nullish_assignment) logical nullish assignment.
  * [destructuring assignment](/web/js/grammar/op/assign/destruct.md) - [`[a, b] = arr`, `{ a, b } = obj`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment)
    {% endtab %}

{% tab title="📗 參考" %}

* [ ] [JavaScript: The Definitive Guide](/web/master/ref/javascript-the-definitive-guide.md) ⟩ 4.11 Assignment Expressions
  {% endtab %}

{% tab title="📘 手冊" %}

* [Expressions and operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators) ⟩ [assignment operators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators#assignment_operators)
  {% endtab %}
  {% endtabs %}
