We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f2018ab commit 2482ef0Copy full SHA for 2482ef0
2 files changed
assignments/closure.js
@@ -1,6 +1,16 @@
1
// ==== Challenge 1: Write your own closure ====
2
// Write a simple closure of your own creation. Keep it simple!
3
+function addition(x) {
4
+ return function(y) {
5
+ return x + y;
6
+ };
7
+}
8
9
+var add5 = addition(5);
10
+var add10 = addition(10);
11
+
12
+console.log(add5(2)); // 7
13
+console.log(add10(2)); // 12
14
15
/* STRETCH PROBLEMS, Do not attempt until you have completed all previous tasks for today's project files */
16
assignments/index.html
@@ -10,7 +10,6 @@
<script src="array-methods.js"></script>
<script src="callbacks.js"></script>
<script src="closure.js"></script>
- <script src="stretch-function-conversion.js"></script>
</head>
<body>
0 commit comments