how to reverse number in js code example
Example 1: reverse int js
function reverseInt(n) {
const reversed = n.toString().split("").reverse().join("");
return parseInt(reversed) * Math.sign(n);
}
Example 2: js reverse number
const reversedNum = num => parseFloat(num.toString().split('').reverse().join('')) * Math.sign(num)