function digital_root(n) {
let result = String(n).split('');
result = result.reduce((prev, item, i) => +prev + +item, 0);
if( String(result).length == 1 ) {
console.log(result);
return result;
}
digital_root(result);
}
console.log(digital_root(493193));