I'm using Node.js and making multiple Asynchronous calls that I need to handle data with when they all finish. I was nesting them, but this was really inefficient as one wouldn't start until the previous finished. I came up with this, and just wondering if there's anything blatantly wrong with it:
var f = function(){},
    actualCallback = function() { /* Do real stuff */ },
    callbacks = [f, f, f, f, actualCallback];
aync(function() {
    callbacks.shift()();
});
aync(function() {
    callbacks.shift()();
});
aync(function() {
    callbacks.shift()();
});
aync(function() {
    callbacks.shift()();
});
aync(function() {
    callbacks.shift()();
});
 
     
    