Name

- — NN 2 IE J1 ECMA 1

Synopsis

The negation operator. This unary operator negates the value of the single operand. For example, in the following statements:

a = 5
b = -a

the value of b becomes -5. A negation operator applied to a negative value returns a positive value.

Example

var myOpposite = -me

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.