Promise is an object that returns the value of an asynchronous operation. So you might wonder what’s an asynchronous operation. They are code that runs without blocking the execution of other code. This means different parts of your script can run at the same time without being blocked.
console.log() from executing until it finishes its own execution and so on.
This is all fine and dandy until you beed a function that queries a database or returns a payload from an API, both of which might take a considerable amount of time. Instead of waiting for the resource requests to be finished, you might want other code to be executing. You can do this by using the
Below is an example of async operations running concurrently with synchronous operations: