File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,15 @@ function myFunction() {
80
80
81
81
myFunction ();
82
82
```
83
+ Made by Yash: https://github.com/yash-kapila/HYF-JS2-Week3/blob/master/src/scope.js
83
84
### Essence
84
85
Same link as Explanation
85
86
86
87
## 3. What hoisting is and the difference between compile time and run time
87
88
### Explanation
88
89
### Example
89
90
### Exercise
91
+ Made by Yash: https://github.com/yash-kapila/HYF-JS2-Week3/blob/master/src/hoisting.js
90
92
### Essence
91
93
Notes:
92
94
@@ -98,13 +100,29 @@ SECOND HALF (14.00 - 16.00)
98
100
99
101
## 4. The use and purpose of closures
100
102
### Explanation
103
+
101
104
### Example
102
- ### Exercise
103
- ### Essence
104
- Notes:
105
105
106
- - Used for data privacy
107
- - Access to the environment of the outer function
106
+ Credits to Yash:
107
+ ``` Javascript
108
+ {
109
+ ' use strict' ;
110
+
111
+ const printName = () => {
112
+ const message = ' My name is ' ;
108
113
114
+ const displayName = name => {
115
+ console .log (` ${ message}${ name} ` );
116
+ }
117
+
118
+ return displayName;
119
+ };
120
+
121
+ const name = printName ();
122
+ name (' Yash Kapila' );
123
+ }
124
+ ```
125
+ ### Exercise
126
+ ### Essence
109
127
110
128
You can’t perform that action at this time.
0 commit comments