Subtraction (-)

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

语法

Operator: x - y

Examples

Subtraction with numbers

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

Subtraction with non-numbers

'foo' - 3 // NaN

Specifications

Specification
ECMAScript (ECMA-262)
Subtraction operator

Browser compatibility

BCD tables only load in the browser

See also