JSFiddle - React, Tailwind, and code Playground

by youssef moudine

JavaScript

function timeout(fct, delay, call_immediately) {
    if(call_immediately) fct();
		console.log('wait...')
    setTimeout( () => {
        fct();
        timeout(fct, delay, false);
    }, delay);
}


function foo(){
	console.log('call function foo')
}

timeout(foo, 1000, true);