g.js — graphical objects for JavaScript

negatenegate

Switch the sign of the input value.

Positive values turn negative:

g.negate(42);

And negative values turn positive:

g.negate(-33);

Zero stays zero:

g.negate(0);