Created
February 17, 2022 22:31
-
-
Save gpDA/a0c7302741bb8a9c690dc64c06abf63e to your computer and use it in GitHub Desktop.
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
const recursiveDigitSum = (number) => { | |
if (number === 0) return 0; | |
return number % 10 + recursiveDigitSum(Math.floor(number / 10)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment