-
Notifications
You must be signed in to change notification settings - Fork 5
/
ayncawait.js
45 lines (41 loc) · 916 Bytes
/
ayncawait.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
41
42
43
44
45
async function fetchUsers() {
return [
{
firstName: 'prince',
lastName: 'pritam',
course: 'BE-6'
},
{
firstName: 'pallab',
lastName: 'nandi',
course: 'BE-6'
},
{
firstName: 'Haganesh',
lastName: 'kumar',
course: 'BE-6'
},
{
firstName: 'Mayur',
lastName: 'shrivas',
course: 'BE-6'
}
];
}
async function concat(users) {
let result = [];
for(let user of users) {
result.push(user.firstName + user.lastName);
}
return result;
}
async function display(value) {
console.log(value);
}
async function performOperation() {
let users = await fetchUsers();
let concatenated = await concat(users);
await display(concatenated);
}
performOperation();
console.log('hey');