var list = ["your", "mom"];
var count = 0;
for(var i = 0; i < list.length; ++i) {
getSomething(list[i], function() {
if(++count == list.length)
imDone();
});
}
another way is like this
var biscuits = ["cheddar", "butter milk"];
(function eatBiscuits(location) {
eatIt(biscuits[++location], whenAllEaten);
typeof biscuits[location] != "undefined" && eatBiscuits(location);
}(-1))
function eatIt(biscuit, cb) {
if (typeof biscuit == "undefined") {
cb();
} else {
stuffMyFace();
}
}