Last active
September 27, 2020 20:43
-
-
Save TechWithTy/36e801d5260c34f71bd8cc187ba3120a to your computer and use it in GitHub Desktop.
Reverse Intiger Algorithim
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
/** | |
* @param {number} x | |
* @return {number} | |
*/ | |
var reverse = function (x) { | |
return parseFloat(x.toString().split('').reverse().join('')) * Math.sign(x); | |
}; | |
//https://www.freecodecamp.org/news/js-basics-how-to-reverse-a-number-9aefc20afa8d/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment