Skip to content

Commit 916144a

Browse files
committed
Synchronous and Asynchronous
1 parent d57b288 commit 916144a

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

12_Asynchronous_Concepts/12.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,25 @@ const myTimeout = setTimeout(() => console.log("Lets play"), 5000);
1919
console.log("logging in the bottom");
2020
```
2121

22+
#### Introduction to Synchronous and Asynchronous
23+
24+
```js
25+
// Synchronous Code
26+
const functionOne = () => {
27+
console.log("Function One"); // 1
28+
29+
functionTwo();
30+
31+
console.log("Function One, Part two"); // 3
32+
};
33+
34+
const functionTwo = () => {
35+
console.log("Function two"); // 2
36+
};
37+
38+
```
39+
40+
```
41+
42+
```
43+

12_Asynchronous_Concepts/script.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@
77

88
// setTimeout
99
// clearTimeout
10-
const myTimeout = setTimeout(() => console.log("Lets play"), 5000);
10+
// const myTimeout = setTimeout(() => console.log("Lets play"), 5000);
1111

12-
console.log("logging in the bottom");
12+
// console.log("logging in the bottom");
13+
14+
// Synchronous Code
15+
// const functionOne = () => {
16+
// console.log("Function One"); // 1
17+
18+
// functionTwo();
19+
20+
// console.log("Function One, Part two"); // 3
21+
// };
22+
23+
// const functionTwo = () => {
24+
// console.log("Function two"); // 2
25+
// };
26+
27+
const functionOne = () => {
28+
console.log("Function One"); // 1
29+
30+
functionTwo();
31+
32+
console.log("Function One, Part two"); // 2
33+
};
34+
35+
const functionTwo = () => {
36+
setTimeout(() => console.log("Function two"), 2000); // 3
37+
};
38+
39+
functionOne();

0 commit comments

Comments
 (0)