Skip to content

Commit 7f916db

Browse files
committed
Solve closure questions
A function to show JavaScript closure in action is added to the file.
1 parent 72c6538 commit 7f916db

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

assignments/closure.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
// ==== Challenge 1: Write your own closure ====
22
// Write a simple closure of your own creation. Keep it simple!
33

4+
function outer() {
5+
var b = 160;
6+
function inner() {
7+
8+
var a = 560;
9+
console.log(a + b);
10+
}
11+
inner();
12+
}
413

14+
outer();
515
/* STRETCH PROBLEMS, Do not attempt until you have completed all previous tasks for today's project files */
616

717

0 commit comments

Comments
 (0)