I'm trying to print the return value of a function but I just can't seem to do it. I keep getting undefined for the last line.
let count = 0;
function product(num){
let result = 1;
strNum = num.toString()
strNumArr = strNum.split("")
if(strNum.length === 1){
return count;
}
for(let i = 0; i< strNum.length; i++){
result *= parseInt(strNumArr[i])
}
count++;
//console.log(count)
product(result)
}
let bool = product(39);
console.log(product(39));
I know I'm missing something basic, but I don't know what it is.
countvariable?