WEBVTT

1
00:00:00.000 --> 00:00:03.680
When the page loads we're fetching the
list of breeds and the random breed image.

2
00:00:05.050 --> 00:00:10.120
JavaScript promises provide an
easier more efficient way to fire off and

3
00:00:10.120 --> 00:00:14.185
keep track of multiple async operations
concurrently or at the same time.

4
00:00:14.185 --> 00:00:17.264
with the Promise.all method.

5
00:00:17.264 --> 00:00:21.520
Promise.all joins two or more promises and

6
00:00:21.520 --> 00:00:26.510
returns only when all the specified
promises have completed or been rejected.

7
00:00:26.510 --> 00:00:28.640
Then, we determine what to do next.

8
00:00:28.640 --> 00:00:30.000
For instance, we can use
Promise.all to fetch our two URLs.
