Stavros Kefaleas

Back-end Developer

Front-end Developer

Freelancer

Programmer

Stavros Kefaleas
Stavros Kefaleas
Stavros Kefaleas
Stavros Kefaleas

Back-end Developer

Front-end Developer

Freelancer

Programmer

Blog Post

Javascript Promise.All Explained

Javascript Promise.All Explained

Let’s see an example with two functions that get some posts and users from the well known jsonplaceholder.typicode.com web site that has already some sample end points ready.

Here is the code:

These two functions access the network separately and each one returns a promise with some sample results.

Now since we are getting both the posts and the users that they made them, we need to wait for both sets to be downloaded, so that there are no orphaned posts or users in our forum application.

Here is how we can do that:

Tags: