The unary minus operator

The unary minus operator (-...) will first convert its operand into Number in the same way as the unary + operator, detailed in the last section, and will then negate it:

-55;    // => -55-(-55); // => 55-'55';  // => -55

Its usage is fairly straightforward and intuitive, although, as with unary +, it's useful to disambiguate cases where you have a unary operator next to its binary operator counterpart. Cases like these can be confusing: 

number - -otherNumber

It is best, in these situations, to lend clarity with parentheses:

number - (-otherNumber)

The unary minus operator is usually only used directly with a literal number operand to specify a negative value. As with all other arithmetic operators, we should ensure ...

Get Clean Code in JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.