let contador = 0;

function iniciarContador(callback) {
    contador++;
callback(contador);
setTimeout(() => {
iniciarContador(callback)
}, 5000);
}

function mostrarContador(valor) {
    console.log("Contador:", valor);
}

iniciarContador(mostrarContador);

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: