How do I reverse the digits of a number using bitwise?
input:
x = 123;
output:
x = 321;
Reversing The Positive/ Negative Integer Number
function reverseInt(n) { return parseInt(n.toString().split('').reverse().join()) * Math.sign(n) }
If n is -5, then Math.sign(n)==> will return -1 If n is 5, then Math.sign(n)==> will return 1
If n is -5, then Math.sign(n)==> will return -1
If n is 5, then Math.sign(n)==> will return 1