Skip to content

Commit 232a399

Browse files
committed
I believe I met MVP at this point. I have commented out some solutions as I provided several for some problems. Also, I commented out the .js files in index.html that are not being tested to make it easier to read in the console.
1 parent caa28ff commit 232a399

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

assignments/closure.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
// ==== Challenge 1: Write your own closure ====
22
// Write a simple closure of your own creation. Keep it simple!
3+
function kindOfCar(year, make, model){
4+
let yourCar = 'You drive a ';
35

6+
function makeCar() {
7+
return `${yourCar} ${year}, ${make} ${model}`
8+
}
9+
return makeCar();
10+
};
411

12+
console.log(kindOfCar(2011, 'Lexus', 'IS350'));
513

614
/* STRETCH PROBLEMS, Do not attempt until you have completed all previous tasks for today's project files */
715

@@ -20,14 +28,3 @@ const counterFactory = () => {
2028
// `increment` should increment a counter variable in closure scope and return it.
2129
// `decrement` should decrement the counter variable and return it.
2230
};
23-
24-
function showName (firstName, lastName) {
25-
var nameIntro = "Your name is ";
26-
// this inner function has access to the outer function's variables, including the parameter
27-
function makeFullName () {
28-
return nameIntro + firstName + " " + lastName;
29-
}
30-
return makeFullName ();
31-
}
32-
33-
showName ("Michael", "Jackson"); // Your name is Michael Jackson

0 commit comments

Comments
 (0)