We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cadb0ed commit 0a5b1d8Copy full SHA for 0a5b1d8
2 files changed
JavaScript/8-all.js
@@ -0,0 +1,19 @@
1
+'use strict';
2
+
3
+const fetch = require('./6-fetch.js');
4
5
+const baseUrl = 'http://localhost:3000/';
6
7
+const promises = [
8
+ fetch(baseUrl + '/person'),
9
+ fetch(baseUrl + '/'),
10
+ fetch(baseUrl + '/city')
11
+];
12
13
+Promise.all(promises)
14
+ .then(values => {
15
+ console.log(values);
16
+ })
17
+ .catch(err => {
18
+ console.log(err);
19
+ });
JavaScript/9-race.js
+Promise.race(promises)
+ .then(res => {
+ console.log(res);
0 commit comments