-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathasync_vs_sync.html
More file actions
38 lines (28 loc) · 1001 Bytes
/
async_vs_sync.html
File metadata and controls
38 lines (28 loc) · 1001 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
<!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>Asynchrronous programmingonoues ve Sync</title>
</head>
<body>
<script>
//CHECK OUT HE ORDER IN WHICH THEY GET LOGGED ON THE CONSOLE.SYNCHRONOOUS CODE WILL BE EXECUTED FIRST ALWAYS
//MOST FUNCTIONS THAT TAKE FUNCTION RGUMENTS ARE GOING TO BE ASYNCHRONOUS FUNCTIONS
//in assynchronous progrmming, a funtion is called after something else has happened or some condition has been met
let a = 1
let b = 2
setTimeout(function() {
console.log("Async . timeout:" + a)
}, 100)
a = 10
fetch("/async_vs_sync.html").then(function() {
console.log("FEtch")
})
console.log("synchronous")
console.log(a) //sync
console.log(b) //sync
</script>
</body>
</html>