loading...

re: Solving the Digital Root Algorithm using JavaScript VIEW POST

FULL DISCUSSION
 

Thank you! I like those tiny little programming "snacks" :)


shortest (recursion) solution I could find:

const dr = r => r < 10 ? r : dr([...r+''].reduce((b,c) => +b+(+c)));

dr(129); // 3
code of conduct - report abuse