I tend to use a little utility function like this:
function asyncCallback( iterations, onComplete ){
var total = iterations.length || iterations, count = 0;
return function( func ){
func();
if ( ++count == total ) onComplete();
};
}
var arr = [1,2,3];
var async = asyncCallback(arr, function(){
console.log('donezo!');
});
arr.forEach(function(num){
setTimeout(function(){
async(function(){
console.log(num);
});
}, 200);
});