<script> function getPersistence(number) { let i = 0; while (number > 9) { i++; let [a, ...b] = number.toString(); for (let k of b) a *= k; number = a } return i } document.write(getPersistence(39)) </script>