I know there are lots of question on this subject, but all of them are tailored to a specific case. I'm asking this question and hoping for an answer that everyone can use when looking into this matter.
Say I have three functions that need to be executed in order, and they all do something async.
For two functions it's simple with a callback:
var fOne = function(callback) {
// do stuff
callback();
};
var fTwo = function() {
// do stuff
};
Calling:
fOne(fTwo);
Makes fTwo to be run after fOne is complete. How does one add fThree into this case so that it is run after fTwo, which is run after fOne?