The last example(using promise) is the same as the previous one(using await).
We have a promise inside fetch because parsing response as json response.json() returns a promise. For each API call, Promise.all() will first wait for the API call's response to arrive, and then it will wait for the json parsing to complete.
When Promise.all takes an array of promises, it will wait for all the inner promises as well to get resolved.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The last example(using promise) is the same as the previous one(using await).
We have a promise inside fetch because parsing response as json
response.json()
returns a promise. For each API call,Promise.all()
will first wait for the API call's response to arrive, and then it will wait for the json parsing to complete.When Promise.all takes an array of promises, it will wait for all the inner promises as well to get resolved.