-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2801.html
More file actions
40 lines (37 loc) · 913 Bytes
/
2801.html
File metadata and controls
40 lines (37 loc) · 913 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Async Await</title>
</head>
<body>
<p>
We can declare any fn as syncronouse by keyword Async. Within that
function if we want to wait for some response then that fn declared as
await.
</p>
</body>
<script type="application/javascript">
const firstfn = () => {
return "I am first one";
};
const secondfn = () => {
return new Promise((data) => {
setTimeout(() => {
data("I am second");
}, 5000);
});
};
const thridfn = () => {
return "I am third one";
};
callall = async () => {
console.log(firstfn());
const sec = await secondfn();
console.log(sec);
console.log(thridfn());
};
callall();
</script>
</html>