This site is mobile accessible. Press the "Tap Here" button to use a different font-size.
Smartphone icons created by Freepik - Flaticon
Assignment operators assign values to JavaScript variables.
Operator | Example | Same As |
---|---|---|
= | x = y | x = y |
+= | x += y | x = x + y |
-= | x -= y | x = x - y |
*= | x *= y | x = x * y |
/= | x /= y | x = x / y |
%= | x %= y | x = x % y |
<<= | x <<= y | x = x << y |
>>= | x >>= y | x = x >> y |
>>>= | x >>>= y | x = x >>> y |
&= | x &= y | x = x & y |
^= | x ^= y | x = x ^ y |
|= | x |= y | x = x | y |
**= | x **= y | x = x ** y |
The **= operator is a part of ECMAScript 2016.
The
assignment operator assigns a value to a variable.var x = 10;
The
assignment operator adds a value to a variable.var x = 10; x += 5;
The
assignment operator subtracts a value from a variable.var x = 10; x -= 5;
The
assignment operator multiplies a variable.var x = 10; x *= 5;
The
assignment divides a variable.var x = 10; x /= 5;
The
assignment operator assigns a remainder to a variable.var x = 10; x %= 5;
Eventually the navigation links, above, will be replaced by these (previous) and (next) buttons below.
JavaScript icons used in the buttons provided by ICONS8.COM. Smartphone icons created by Freepik - Flaticon