A demonstration of asynchronous code that starts off broken (db.close is invoked before the db calls return) then is parallelized by only returning the results after all db calls have returned, then leverages async.js to abstract away some of the logic. The last example simplified it even further by avoiding the IIFE that was needed to bind i to a given loop iteration.