Created
June 15, 2021 20:05
-
-
Save Elijah-trillionz/aba441cc9ae1e55e3ba26517b02d319f to your computer and use it in GitHub Desktop.
Reverse a number in JavaScript
This file contains 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 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