reverse no. in javascript code example
Example 1: reverse number in js
function reversedNum(num) {
return (
parseFloat(
num
.toString()
.split('')
.reverse()
.join('')
) * Math.sign(num)
)
}
Example 2: js reverse number
const reversedNum = num => parseFloat(num.toString().split('').reverse().join('')) * Math.sign(num)