reverseNumber
Reverses a number.
- Use
Object.prototype.toString()
to convertn
to a string. - Use
String.prototype.split('')
,Array.prototype.reverse()
andString.prototype.join('')
to get the reversed value ofn
as a string. - Use
parseFloat()
to convert the string to a number andMath.sign()
to preserve its sign.