Subtraction (-)

The subtraction operator (-) subtracts the two operands, producing their difference.

Syntax

x - y

Examples

Subtraction with numbers

5 - 3     // 2
3 - 5     // -2

Subtraction with non-numbers

'foo' - 3 // NaN

Specifications

Specification
ECMAScript Language Specification
# sec-subtraction-operator-minus

Browser compatibility

BCD tables only load in the browser

See also