Skip to content

Commit c6263ce

Browse files
committed
completed closure
1 parent 1f1bfec commit c6263ce

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

assignments/array-methods.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const runners = [{"id":1,"first_name":"Charmain","last_name":"Seiler","email":"c
5757
// The event director needs both the first and last names of each runner for their running bibs. Combine both the first and last names into a new array called fullName.
5858
let fullName = [];
5959
runners.forEach(runners => fullName.push(runners.first_name + ' ' + runners.last_name));
60-
// console.log(fullName);
60+
console.log(fullName);
6161

6262
// ==== Challenge 2: Use .map() ====
6363
// The event director needs to have all the runner's first names converted to uppercase because the director BECAME DRUNK WITH POWER. Convert each first name into all caps and log the result
@@ -66,15 +66,15 @@ runners.map(runner => allCaps.push(runner.first_name));
6666
allCaps = allCaps.map(function(firstNameCap) {
6767
return firstNameCap.toUpperCase();
6868
});
69-
// console.log(allCaps);
69+
console.log(allCaps);
7070

7171
// ==== Challenge 3: Use .filter() ====
7272
// The large shirts won't be available for the event due to an ordering issue. Get a list of runners with large sized shirts so they can choose a different size. Return an array named largeShirts that contains information about the runners that have a shirt size of L and log the result
7373
let largeShirts = [];
7474
largeShirts = runners.filter((state) => {
7575
return state.shirt_size === "L";
7676
});
77-
// console.log(largeShirts);
77+
console.log(largeShirts);
7878

7979
// ==== Challenge 4: Use .reduce() ====
8080
// The donations need to be tallied up and reported for tax purposes. Add up all the donations into a ticketPriceTotal array and log the result

assignments/closure.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// ==== Challenge 1: Write your own closure ====
22
// Write a simple closure of your own creation. Keep it simple!
3-
3+
const coffee = 'vanilla latte';
4+
function drink() {
5+
return coffee;
6+
}
7+
drink();
8+
console.log(drink());
49

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

0 commit comments

Comments
 (0)