Loading Please Wait...
Assignment operators assign values to JavaScript variables.
The Simple Assignment Operator assigns a value to a variable.
let a = 5;
let b = a + 2;
The Addition Assignment Operator adds a value to a variable.
let a = 5;
a += 10;
The Subtraction Assignment Operator subtracts a value from a variable.
let a = 5;
a -= 10;
The Multiplication Assignment Operator multiplies a variable.
let a = 5;
a *= 10;
The Exponentiation Assignment Operator raises a variable to the power of the operand.
let a = 5;
a **= 10;
The Division Assignment Operator divides a variable.
let a = 5;
a /= 10;
The Remainder Assignment Operator assigns a remainder to a variable.
let a = 5;
a %= 10;
The Left Shift Assignment Operator left shifts a variable.
let a = 5;
a <<= 10;
The Right Shift Assignment Operator right shifts a variable (signed).
let a = 5;
a >>= 10;
The Unsigned Right Shift Assignment Operator right shifts a variable (unsigned).
let a = 5;
a >>>= 10;
The Bitwise AND Assignment Operator does a bitwise AND operation on two operands and assigns the result to the the variable.
let a = 5;
a &= 10;
The Bitwise OR Assignment Operator does a bitwise OR operation on two operands and assigns the result to the variable.
let a = 5;
a |= 10;
The Bitwise XOR Assignment Operator does a bitwise XOR operation on two operands and assigns the result to the variable.
let a = 5;
a ^= 10;
The Logical AND Assignment Operator is used between two values. If the first value is true, the second value is assigned.
let a = 5;
a &&= 10;
The Logical OR Assignment Operator is used between two values. If the first value is false, the second value is assigned.
let a = 5;
a ||= 10;
The Nullish coalescing Assignment Operator is used between two values. If the first value is undefined or null, the second value is assigned.
let a = 5;
a ??= 10;
How you feel about this blog:
Share this blog on:
If you find any error in the turtorials, or want to share your suggestion/feedback, feel free to send us email at: info@lynxsia.com
Contact UsWe are concern with various development process like website design & development, E-commerce development, Software development, Application development, SMS & Bulk SMS Provider, PWA Development, and many more..
Copyright ©
, Lynxsia IT Solutions, All rights reserved