Skip to content

Instantly share code, notes, and snippets.

@TechWithTy
Last active September 27, 2020 20:43
Show Gist options
  • Save TechWithTy/36e801d5260c34f71bd8cc187ba3120a to your computer and use it in GitHub Desktop.
Save TechWithTy/36e801d5260c34f71bd8cc187ba3120a to your computer and use it in GitHub Desktop.
Reverse Intiger Algorithim
/**
* @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