const persistence = (x) => (x.toString().length === 1 ? 0 : persistence(x.toString().split('').reduce((acc, a) => acc * a, 1)) + 1);

console.log(persistence(5));
console.log(persistence(52));
console.log(persistence(377));
console.log(persistence(39));

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.