-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr) JS AsyncAwait Insta feed.js
More file actions
49 lines (45 loc) · 1.08 KB
/
r) JS AsyncAwait Insta feed.js
File metadata and controls
49 lines (45 loc) · 1.08 KB
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
46
47
48
49
// create your own instagram
async function like()
{
return new Promise(
function(like_post){
setTimeout(function(){
like_post("1st post's like");
}, 1000);
}
)
}
async function comment()
{
return new Promise(
function(comment_post){
setTimeout(function(){
comment_post("1st post's comment");
}, 1000);
}
)
}
async function share()
{
return new Promise(
function(share_post){
setTimeout(function(){
share_post("1st post's share");
}, 1000);
}
)
}
async function post()
{
var post=new Promise(function(postresponse){
setTimeout(function(){
postresponse("1st post");
}, 1000);
});
var [feed,commentp,likep,sharep]=await Promise.all([post,like(),comment(),share()]);
console.log(await post);
console.log(await likep);
console.log(await commentp);
console.log(await sharep);
}
post();