JSFiddle - React, Tailwind, and code Playground

JavaScript

function y(f) {
    return function () {
        return f(y(f)).apply(this, arguments);
    };
}

y(function (f) {
    return function (i) {
        console.log(i);
        if (i < 3) return f(i + 1);
        else return i;
    };
})(0);