根据传入的数字,把不同位数一直相乘,直到结果小于10为止返回运算次数
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); } }