How does promise.all work?

前端 未结 4 1236
余生分开走
余生分开走 2020-12-06 17:29

I started diggin\' in promises and found interesting Promise.all.

It is stated in MDN that

The Promise.all(iterable) method returns a promise

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 18:10

    Your get function returns a Promise. You are just passing a reference to the get function. You have to pass an array of Promises

    Promise.all([get("one.jpg")]).then(...);
    

提交回复
热议问题