VOOZH about

URL: https://www.geeksforgeeks.org/javascript/subtraction-assignment-operator-in-javascript/

⇱ Subtraction Assignment( -=) Operator in Javascript - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Subtraction Assignment( -=) Operator in Javascript

Last Updated : 23 Jul, 2025

The Subtraction Assignment Operator( -=) is used to subtract a value from a variable. This operator subtracts the value of the right operand from a variable and assigns the result to the variable, in other words, allows us to decrease the left variable from the right value.

Syntax:

a -= b 

We will now see some examples of the javascript Subtraction Assignment (-=).

Example 1: In this example, we will use the Subtraction Assignment Operator on numerical values.

Output:

4

Example 2: In this example, we will be subtracting a string with a number using the subtraction assignment operator.

Output:

NaN

Supported browser:

  • Google Chrome
  • Mozilla Firefox
  • Safari
  • Internet Explorer

We have a complete list of Javascript Assignment operators, to check those please go through the Javascript Assignment Operators.

Comment
Article Tags: