We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 55cbd50 + ffd8a23 commit bd0870aCopy full SHA for bd0870a
code-snippets/scopes&closures.md
@@ -0,0 +1,42 @@
1
+<div align="center">
2
+ <h1>Scopes & Closures</h1>
3
+</div>
4
+
5
+<ol>
6
+<li>
7
8
+**Which variables end up being part of `func's` closure ?**
9
10
+```JS
11
+var c = 10;
12
13
+function foo(a){
14
+ let b = 8;
15
+ const d = 10;
16
+ return function bar(){
17
+ return a + d + c;
18
+ }
19
+}
20
21
+const func = foo(7);
22
+```
23
24
+- A: `a and d`
25
+- B: `a,b and d`
26
+- C: `a,b,c and d`
27
+- D: `a,d and c`
28
29
+<br/>
30
31
+<details>
32
+<summary><b>Answer</b></summary>
33
+<p>
34
35
+#### Option: A
36
37
+</p>
38
+</details>
39
40
+</li>
41
+</ol>
42
0 commit comments