Thats how I do it:
function processArray(array, index, callback) { processItem(array[index], function(){ if(++index === array.length) {
As correctly pointed out, you have to use setTimeout, for example:
each_async = function(ary, fn) { var i = 0; -function() { fn(ary[i]); if (++i < ary.length) setTimeout(arguments.callee, 0) }() } each_async([1,2,3,4], function(p) { console.log(p) })