Minus Plus, plus minus
Make minus in the formula and minus in the formula
Let N1 =-(12); Let N2 =-(-10); Console.log (N1, N2); -12, 10
In the code above, 12 is inverted to a negative value of -12 and -10 is inverted to a positive value of 10.
Make only minus
Use Math.abs ()
It is a method to change only negative value to positive value by Math.abs ().
Math.Abs () Sample code
Let N1 = Math.abs (12); Let N2 = Math.abs (-10); Console.log (N1, N2); 12, 10
In the above code, 12 remains unchanged and -10 is inverted to 10.