We are your Digital Ally™
Tech Talks: Async JavaScript
education

Tech Talks: Async JavaScript

An overview of asynchronous programming patterns in JavaScript — callbacks, async library, Promises (ES6), and async/await (ES7).

Stanislav MiklikDecember 4, 2015

Especially when you are coming from a Java background, the first encounter with asynchronous style used in JavaScript (or Node.js) can be confusing. And of course there are several ways how to deal with it.

Callback Hell

The most basic approach to async JavaScript is the callback pattern. As with other styles, modularization and good naming helps in readability. See callbackhell.com for practical advice on keeping callbacks manageable.

Async Library

The async npm package helps with increasing indentation levels and covers almost any use case. It provides utilities for common async patterns like series, parallel, waterfall and more.

Promises (ES6)

Promises offer a different style than Node.js's default error-first callbacks. Promise-based code feels more natural since results return directly rather than through callback parameters.

For wrapping existing Node.js callback APIs, es6-promisify can be helpful. However, there are some caveats around inconsistent error handling to be aware of.

async/await (ES7)

At the time of writing, async/await was still not standardized — you needed Babel or a similar transpiler. The pattern resembles Promises but presents challenges with higher-order functions.

Conclusion

Till now there is no obvious winner among these approaches, and maybe the future will show which pattern becomes the standard. Each has its place depending on the complexity of the problem and the codebase.

© 2026