-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanswer.js
40 lines (35 loc) · 951 Bytes
/
answer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const members = require("./2th/members");
const getOnline = members => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const data = members.filter(o => o.location === "online");
resolve(data);
}, 500);
});
};
const getOffline = members => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const data = members.filter(o => o.location === "offline");
resolve(data);
}, 500);
});
};
const getYB = members => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const data = members.filter(o => o.group === "YB");
resolve(data);
}, 500);
});
};
const getOB = members => {
return new Promise((resolve, reject) => {
setTimeout(() => {
const data = members.filter(o => o.group === "OB");
resolve(data);
}, 500);
});
};
getOnline(members).then(getOB).then(console.log);
getYB(members).then(getOffline).then(console.log);