<script>
function getOne(num){
var strArr=String(num).split("");
var sum=strArr.reduce(function(init,item){
init=init+Number(item);
return init;
},0);
if(sum<10){
return sum;
}else{
getOne(sum);
}
}
console.log(getOne(343));
</script>
I would like to ask why the final printed result is undefined