Think Javascript Promises as promise you makes in real life. Like you promise your friend to buy a coffee, they don't have coffee now but they have guarantee you will apear with a fresh coffee or a come back with excuse to why cafe was closed.
In code promise help use to manage tasks which takes time like fetching data from server or leading heavy image wihout freezing the entire code while we waiting.
Content List
What Problem Promises Solve
Promise States (Pending, Fulfilled, Rejected)
Basic Promise Lifecycle
Handling Success and Failure
Promise Chaining Concept
What Problem Promises Solve
Before promises javascript used callbacks to perform tasks. If you need to do three taks depends on each other like logic user, fetch user profile, fetch user posts then you would end up nesting function inside funciton inside function.
This creates infamous callback hell also known as pyramid of doom .…