赋值运算符

一个 赋值运算符(assignment operator)将它右边操作数的值赋给它左边的操作数。

下列为 ECMAScript 标准规范的 Assignment Operator:

* = /= %= += -= <<= >>= >>>= &= ^= |= **=

运算名称简写的操作符分解含义符号
赋值x = yx = y=
加法赋值x += yx = x + y+=
减法赋值x -= yx = x - y-=
乘法赋值x *= yx = x * y*=
除法赋值x /= yx = x / y/=
求余赋值x %= yx = x % y%=
求幂赋值x ** yx = x ** y**
左移位赋值x <<= yx = x << y<<=
右移位赋值x >>= yx = x >> y>>=
无符号右移位赋值x >>>= yx = x >>> y>>>=
按位与赋值x & yx = x & y&
按位异赋值x ^= yx = x ^ y^=
按位或赋值x |= yx = x | y| y