The use of callback functions is so common in JavaScript that often you find that in the callback from one asynchronous operation the only option that you have is to start another. In many cases you end up having a long chain of callbacks within callbacks, a situation that is appropriately referenced as callback hell.
Modern JavaScript has introduced the concept of Promises to better deal with asynchronous notifications and prevent callback hell. In this article I'm going to show how to work with libraries based on promises, how to use promises in your own functions, and how to upgrade callback-based functions to promises.