is it possible in jScript to do something like the following using multiple anonymous setTimeout functions?
var eventCounter;
// wait for eventCounter to be equal to 1
console.log('eventCounter is now equal to one');
// pause for eventCounter to be equal to 2
console.log('eventCounter is now equal to two');
// finally, wait for eventCounter to be equal to 3
console.log('eventCounter is now equal to three');
I had hoped something like this might have worked:
setTimeout( () => { // fake code
if ( eventCounter <= 1234 ) {
this(); // fake code, this() is not a function
} else {
console.log('eventCounter is now over 1234');
}
}, 200);
or maybe Promises is the way to go?
otherwise it seems like i end up with some sort of deeply embedded nested perform loop with multiple function names, which i had hoped to avoid.
thank you very much.