Arithmetic Subtraction
-
symbol is used for arithmetic subtraction operator.
arithmetic subtraction operator takes two values/variables as operands and returns the difference of right side operand from the first operand.
a - b //variables
6 - 4 //values
more than one value/variable can be subtracted from a value in a single expression by chaining subtraction operator.
a - b - c - d //variables
6 - 4 - 5 - 10 - 85 //values
Examples
1. subtraction of b
from a
var a = 10;
var b = 25;
var diff = a - b;
console.log(diff);
2. subtraction of more than one value/variable from a value
var a = 10;
var b = 25;
var c = 14;
var diff = a - b - c;
console.log(diff);