-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
82 lines (69 loc) · 1.41 KB
/
index.html
File metadata and controls
82 lines (69 loc) · 1.41 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<script>
/* 面试题一
script start
promise1
2
script end
then1
queueMicrotask1
then3
setTimeout1
then2
then4
setTimeout2
*/
/*
script start
getData start
getData end
script end
setTimeout
then1-res why
*/
/*
script start
getData start
requestData
script end
setTimeout
then1-res why
getData end
*/
/* 面试题二
script strat
async1 start
async2
promise1
script end
async1 end
promise2
seTimeout
*/
async function async1() {
console.log('async1 start')
await async2()
console.log('async1 end')
}
async function async2() {
return new Promise((resolve) => {
console.log('promise1')
resolve()
}).then(() => {
console.log('then1')
})
}
async1()
//
// async1 start、 promise1 then1 async1 end
</script>
</body>
</html>