What are Promises
Last updated
Last updated
The absolute reference: https://www.promisejs.org/
Promises are nothing but a chain of success/fail events
We can use promises in nested callback which are dependent to each other this is termed as a callback hell It is hard to understand and creates lot of confusion.
Promises can handle global errors.
Promises can be chained (you don't have this encapsulation like callbacks)
Promise is an interface class that helps you to control if the call to a function - that may be executed asynchronously - has finished successfully or with an error. It is very similar to have a try-catch-finally block for async calls.