I’m very new to JavaScript… is there a math function to turn a negative number in to positive, and the other way round??
Any help much appreciated!
Nic.
I’m very new to JavaScript… is there a math function to turn a negative number in to positive, and the other way round??
Any help much appreciated!
Nic.
Multiply your number by -1?
As usual - the simplest answer is the best
Cheers,
Nic.
You can also just stick a minus in front of it, like:
var number = 1;
number = -number //(turns it to neg 1)
number = 1;
number = -number //(turns it to positive 1)