Promises is a core language feature that makes Asynchronous programming with Javascript simpler. Promises allow us to work with callbacks in a different manner, by asking the Promise to call the callback function we need.
Imagine a scenario where your friend has promised to accompany you on the day of your driving test to boost your confidence.
Two things can happen
- Promise is kept and you are happy
- For some reason, your friend didn't keep the promise.
In JavaScript, this equates to :
- Promise is fulfilled
- Promise is rejected
References
Flanagan, D., 2020. JavaScript - The Definitive Guide. 7th ed. O'Reilly Media, Inc., pp.342-370.
Javascript.info. 2021. Promise. [online] Available at: https://javascript.info/promise-basics [Accessed 2 June 2021].