I have functions nested here in setTimeout
function startWorker (obj) {
if (!code) {
return setTimeout(2000, () => {
startWorker(obj)
});
}
console.log('worker started')
}
How do I correctly use startWorker as the callback without using more functions than needed.
What I'm trying to do:
I'm trying to run the same function with the same argument as the callback to a setTimeout inside without duplicating function calls.