Javascript is a single threaded language, which essentially means that it has no native support for performing multiple tasks simultaneously. This poses a problem because on UI it is crucial to have an async behaviour. Javascript solves this problem using the event loop. In order to adapt to this async behaviour the simplest option we can opt for are callbacks which have their own issues. Another option available to us is Promises

As per MDN web docs, Promise object represents the eventual completion (or failure) of an asynchronous operation and its resulting value. A promise can be in three states…

Jasmeet Singh

Software engineer, Web enthusiast, Gamer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store