Code writing (in editor) and code execution (in time) have a one-one relation in synchronous (blocking) languages.
The coder expects its code to be executed in the same order it's written.
A reference to executable code, or a piece of executable code, that is passed as an argument to other code. Wikipedia
Deferred callbacks are often used in the context of I/O operations or event handling. Wikipedia
Equivalent of Array.forEach with asynchronous iterations.
Equivalent of Array.map with asynchronous transformations
Check the API, you will find something for your use case
async.js : https://github.com/caolan/async
Slides : https://github.com/DjebbZ/async-paris-js (feel free to read & fork !)
Me : Khalid Jebbari ; Twitter : @Dj3bbZ
Powered by CodeMirror, CodeMirror Movie, Impress.js and Foundation
Special credits to Sergey Chikuyonok (CodeMirror Movie author) for his support !