Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created February 17, 2022 22:31
Show Gist options
  • Save gpDA/a0c7302741bb8a9c690dc64c06abf63e to your computer and use it in GitHub Desktop.
Save gpDA/a0c7302741bb8a9c690dc64c06abf63e to your computer and use it in GitHub Desktop.
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