Skip to content

Instantly share code, notes, and snippets.

@SpencerAung
Created February 26, 2018 11:55
Show Gist options
  • Save SpencerAung/e5d668410bf77ade17ea69a94e25c8e1 to your computer and use it in GitHub Desktop.
Save SpencerAung/e5d668410bf77ade17ea69a94e25c8e1 to your computer and use it in GitHub Desktop.
reverseInt
function reverseInt(n) {
let value = Math.abs(n);
if (value < 10) {
return n;
}
let vStr = '' + value;
vStr.split('').reverse().join('');
return Math.sign(n) * vStr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment