invert number javascript code example
Example 1: makes number negative javascript
Math.abs(num) => Always positive
-Math.abs(num) => Always negative
Example 2: reverse int js
function reverseInt(n) {
const reversed = n.toString().split("").reverse().join("");
return parseInt(reversed) * Math.sign(n);
}