- =
This operator assigns the value of an expression to a variable.
- Example:
var sTmp = "Temp";
var nTmp = 5;
var oTmp = new Object;
|
- *=
This operator mulitplies the value of an expression by the existing value of a variable, and assigns it to the variable.
- Example:
|
- /=
This operator divides the value of an expression by the existing value of a variable, and assigns it to the variable.
- Example:
|
- =
This operator divides the value of an expression by the existing value of a variable, and assigns the remainder to the variable.
- Example:
|
- +=
This operator adds the value of an expression to the existing value of a variable, and assigns it to the variable.
- Example:
var sTmp = "Temp";
var sTmp2 = "String";
sTmp += sTmp2;
var nTmp = 5;
nTmp += 2;
|
- -=
This operator subtracts the value of an expression from the existing value of a variable, and assigns it to the variable.
- Example:
|
- <<=
This operator performs a bitwise left shift on the existing value of a variable by the number of bits specified in the value of an expression, and assigns it to the variable.
- Example:
var nTmp = 13;
nTmp <<= 2;
|
- >>=
This operator performs a bitwise (sign-preserving) right shift on the existing value of a variable by the number of bits specified in the value of an expression, and assigns it to the variable. Digits shifted off the right are discarded.
- Example:
var nTmp = 13;
nTmp >>= 2;
|
- >>>=
This operator performs a bitwise (zero-padding) right shift on the existing value of a variable by the number of bits specified in the value of an expression, and assigns it to the variable. Digits shifted off the right are discarded.
- Example:
var nTmp = -13;
nTmp >>>= 2;
|
- &=
This operator performs a bitwise AND on the value of an expression and the existing value of a variable, and assigns it to the variable. Looking at the binary representation of the variable value and the expression, any time both have a 1 in the digit, a 1 is returned, otherwise a 0 is returned for that digit.
- Example:
var nTmp = 13;
var nTmp2 = 11;
nTmp &= nTmp2;
|
- ^=
This operator performs a bitwise exclusive OR on the value of an expression and the existing value of a variable, and assigns it to the variable. Looking at the binary representation of the variable value and the expression, any time only one has a 1 in the digit, a 1 is returned, otherwise a 0 is returned for that digit.
- Example:
var nTmp = 13;
var nTmp2 = 11;
nTmp ^= nTmp2;
|
- |=
This operator performs a bitwise OR on the value of an expression and the existing value of a variable, and assigns it to the variable. Looking at the binary representation of the variable value and the expression, any time either one has a 1 in the digit, a 1 is returned, otherwise a 0 is returned for that digit.
- Example:
var nTmp = 13;
var nTmp2 = 11;
nTmp |= nTmp2;
|