File tree Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,25 @@ const myTimeout = setTimeout(() => console.log("Lets play"), 5000);
19
19
console .log (" logging in the bottom" );
20
20
```
21
21
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
+
Original file line number Diff line number Diff line change 7
7
8
8
// setTimeout
9
9
// clearTimeout
10
- const myTimeout = setTimeout ( ( ) => console . log ( "Lets play" ) , 5000 ) ;
10
+ // const myTimeout = setTimeout(() => console.log("Lets play"), 5000);
11
11
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 ( ) ;
You can’t perform that action at this time.
0 commit comments