# Assignment Operators in TypeScript

An assignment operator requires two operands. The value of the right operand is assigned to the left operand. The sign = denotes the simple assignment operator. The typescript also has several compound assignment operators, which is actually shorthand for other operators. List of all such operators are listed below

## List of Assignment operators

NameSyntaxMeaning
Assignmentx = yx = y
Addition assignmentx += yx =x+ y
Subtraction assignmentx -= yx = x - y
Multiplication assignmentx *= yx = x * y
Division assignmentx /= yx = x / y
Remainder assignmentx %= yx = x % y
Exponentiation assignmentx **= yx = x ** y
Left shift assignmentx <<= yx = x << y
Right shift assignmentx >>= yx = x >> y
Unsigned right shift assignmentx >>>= yx = x >>> y
Bitwise AND assignmentx &= yx = x & y
Bitwise XOR assignmentx ^= yx = x ^ y
Bitwise OR assignmentx |= yx = x | y
Logical AND assignmentx &&= yx && (x = y)
Logical OR assignmentx ||= yx || (x = y)
Logical nullish assignmentx ??= yx ?? (x = y)

## Simple Assignement Operator

The `=` assignment operator assigns the value of the right hand operand to the left hand variable.

## Compound Assignment Operators

All operators except = listed in the table above are compound assignment operators. They are actually short hand notations

For Examples

The Addition assignment `+=` operator adds a value to a variable.

is actually short hand for