-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestScript.js
More file actions
54 lines (37 loc) · 1.57 KB
/
testScript.js
File metadata and controls
54 lines (37 loc) · 1.57 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
50
51
52
53
54
console.log('person1 shows ticket');
console.log('person2 shows ticket');
const preMovie = async () => {
const person3PromiseToShowTicketWhenWifeArrives = new Promise((resolve, reject) => {
setTimeout(() => resolve('ticket'), 3000);
});
const getPopcorn = new Promise((resolve, reject) => {
setTimeout(() => resolve('popcorn'), 3000);
});
const addButter = new Promise((resolve, reject) => {
setTimeout(() => resolve('butter'), 3000);
});
const getColdDrinks = new Promise((resolve, reject) => {
setTimeout(() => resolve('coldDriks'), 3000);
});
let ticket = await person3PromiseToShowTicketWhenWifeArrives;
console.log(`got the ${ticket}`);
console.log(`Husband:we should go in now`);
console.log(`Wife: "i am hungry"`);
let popcorn = await getPopcorn;
console.log(`Husband: here is ${popcorn}`);
console.log(`Husband:we should go in now`);
console.log(`Wife: "I dont like popcorn without butter!"`);
let butter = await addButter;
console.log(`added ${butter}`);
console.log(`Husband:Anything else darling`);
console.log(`Wife: we shold have some colddrinks`);
console.log(`Husband: off course`);
let coldDrinks = await getColdDrinks;
console.log(`added ${coldDrinks}`);
console.log(`Husband:Anything else darling`);
console.log(`Wife: lets go we are going to miss the preivew`);
console.log(`Husband: thanks for the reminder *grin*`);
return ticket;
};
preMovie().then((t) => console.log(`person4 shows ${t}`));
console.log('person4 shows ticket');