JSFiddle - React, Tailwind, and code Playground

JavaScript

var iterations = 0;

function operation(num){
    iterations++;
    if (num == 0) return 1;
    return operation(Math.floor((num / 10) * 2));
}

var result = operation(1000);

alert('Result = ' + result + ', number of iterations = ' + iterations);