Subtract then assign (-=) (Operator/assignment)

Subtracts the right value from the left, modifying the left-hand value.


ECMAScript edition - 2
JavaScript - 1.0
JScript - 1.0
Internet Explorer - 3.02
Netscape - 2.0
Property/method value type:Number primitive
JavaScript syntax:-anLValue -= anOperand
Argument list:anLValueAn operand that can be assigned into
anOperandA value to subtract

Subtracts the right operand from the left operand and assign the result to the left operand.

This is functionally equivalent to the expression:

anOperand1 = anOperand1 - anOperand2;

Although this is classified as an assignment operator it is really a compound of an assignment and an additive operator.

The associativity is right to left.

Refer to the operator precedence topic for details of execution order.

The new value of anOperand1 is returned as a result of the expression.


See also:Add then assign (+=), Additive operator, Arithmetic operator, Assignment operator, Associativity, Operator Precedence, Subtract (-)


ECMA 262 edition 2 - section 11.13

ECMA 262 edition 3 - section 11.13