Created
September 18, 2018 14:56
-
-
Save spektraldevelopment/85e503869441e0da249e7a7b23d172c0 to your computer and use it in GitHub Desktop.
JS: Reverse Int
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reverseInt(n) { | |
| const sign = Math.sign(n); | |
| const revNum = parseInt(n.toString().split('').reverse().join('')); | |
| return sign * revNum; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment