Skip to content

Commit 88b9b1c

Browse files
committed
Add Promise.prototype.any example
1 parent d254c20 commit 88b9b1c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

JavaScript/a-any.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict';
2+
3+
const baseUrl = 'http://localhost:3000';
4+
5+
const promises = [
6+
fetch(baseUrl + '/person'),
7+
fetch(baseUrl + '/'),
8+
fetch(baseUrl + '/city'),
9+
];
10+
11+
Promise.any(promises)
12+
.then((res) => {
13+
console.log(res);
14+
})
15+
.catch((err) => {
16+
console.log(err);
17+
});

0 commit comments

Comments
 (0)