I want a function in pure JS to wait and execute only when a certain condition happens.
function wait_then_go (a,b,c) {
if (!go) window.setTimeout (wait_then_go (a,b,c), 500);
// go here
}
Is there a general way to pass the arguments in the timeout instead of specifying a,b,c ? I dont want the code to break if I chnage the arguments on the function definition.