Introduction
Start the journey from the simple callback pattern to promise
Start with a simple variable
- A brief explanation about primitive and non-primitive types in JavaScript
Initialize with an object instead of undefined
Define done method on the object
Send the callback to the object
Define resolve method
Refactor the code
Handle the errors
Modularize the code
Register callbacks after resolving
Eliminate nesting by chainable object
- Create a chainable object
- Create a thenable object
Eliminate nesting of thenable object
Register several callbacks before resolving
Implement catch method
Implement resolve and reject as static functions
Conclusion