var mount = 0; function persistence(num) { var numArr = num.toString().split(""); var total = 1; for (var i = 0; i < numArr.length; i++) { total *= parseInt(numArr[i]); } if (numArr.length !== 1) { mount++; } else { return 0; } if (total < 10) { return mount; } else { return persistence(total); } }