Answers for "how to convert minus to plus js"

1

how to convert minus to plus js

// Turn any number positive
let x =  54;
let y = -54;
let resultx =  Math.abs(x); //  54
let resulty =  Math.abs(y); //  54

//Turn any number negative
let x =  54;
let y = -54;
let resultx = -Math.abs(x); // -54
let resulty = -Math.abs(y); // -54

// Invert any number
let x =  54;
let y = -54;
let resultx = -(x);         // -54
let resulty = -(y);         //  54
Posted by: Guest on October-15-2021
0

javascript convert minus to plus

var x = 20;
x *= -1;
Posted by: Guest on June-15-2020
0

javascript convert minus to plus

var posNum = (num < 0) ? num * -1 : num; // if num is negative multiple by negative one ...
Posted by: Guest on June-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language