What assignment operators do JavaScript have?
Nov 24, 2021 pm 05:15 PMThe assignment operators of JavaScript are: "=", "=", "-=", "*=", "/=", "%=", "<<=", " >>=", ">>>=", "&=", "|=", "^=".
The operating environment of this tutorial: Windows 7 system, JavaScript version 1.8.5, Dell G3 computer.
In JavaScript, the assignment operator is used to assign values to variables. The operand on the left side of an assignment operator must be a variable, object property, or array element, also known as an lvalue.
For example, the following writing is wrong because the value on the left is a fixed value and operations are not allowed.
1 |
|
The assignment operation has the following two forms:
Simple assignment operation
=
: Directly copy the value of the operand on the right side of the equal sign to the left operand, so the value of the left operand changes.Assignment operation of additional operations: Before assignment, perform some operation on the right operand, and then copy the operation result to the left operand. The specific instructions are as shown in the table:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
javascript learning tutorial
The above is the detailed content of What assignment operators do JavaScript have?. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to implement an online speech recognition system using WebSocket and JavaScript

WebSocket and JavaScript: key technologies for implementing real-time monitoring systems

How to implement an online reservation system using WebSocket and JavaScript

How to use JavaScript and WebSocket to implement a real-time online ordering system

JavaScript and WebSocket: Building an efficient real-time weather forecasting system

Simple JavaScript Tutorial: How to Get HTTP Status Code

How to get HTTP status code in JavaScript the easy way

How to use insertBefore in javascript

Assignment operator | Explanation | Example | Equivalent to |
---|---|---|---|
= | Addition or concatenation operation and assignment | a = b | a = a b |
-= | Subtraction operation and assignment | a -= b | a= a - b |
*= | Multiplication and assignment | a *= b | a = a * b |
/= | Division operation and assignment | a /= b | a = a / b |
%= | Modulo operation and assignment | a %= b | a = a % b |
<<= | Left shift operation and assignment | a <<= b | a = a << b |
>>= | Right shift operation and assignment | a >>= b | a = a >> b |
##>>>=
| |||
Bitwise AND operation and assignment | a &= b | a = a & b | |
Bitwise OR operation and assignment | |||
Bit XOR operation and assignment a ^= b | a = a ^ b |