-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathasyn.html
41 lines (36 loc) · 880 Bytes
/
asyn.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Async</title>
</head>
<body>
<div>
Count is <span id="small"></span>
</div>
<div id="big">
</div>
<button onclick="smallfun()">Small function</button>
<button onclick="bigfun()">Big function</button>
<script>
var count=1;
function smallfun(){
document.getElementById('small').innerHTML=count;
count++;
}
function bigfun(){
setTimeout(function(){
console.log("big function starts");
for(let i=0;i<100000;i++){
for(let j=0;j<100000;j++){
}
}
console.log("big function ends");
document.getElementById('big').innerHTML="Big function comes to end";
},6000);
}
</script>
</body>
</html>