function persistence(num) {
const digits = `${num}`.split("");
if (digits.length === 1) {
return 0;
}
const product = digits.reduce((product, digit) => {
return product * digit;
}, 1);
return 1 + persistence(product);
}