Skip to content

Instantly share code, notes, and snippets.

@Elijah-trillionz
Created June 15, 2021 20:05
Show Gist options
  • Save Elijah-trillionz/aba441cc9ae1e55e3ba26517b02d319f to your computer and use it in GitHub Desktop.
Save Elijah-trillionz/aba441cc9ae1e55e3ba26517b02d319f to your computer and use it in GitHub Desktop.
Reverse a number in JavaScript
function reverseNumber(givenNum) {
const numInArr = givenNum.toString().split('');
numInArr.reverse();
return +numInArr.join('');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment