You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With some basic JavaScript principles we can now expand our skills out even further by exploring array methods like: `.forEach()`, `.map()`, `.reduce()`, and `.filter()`. We can also look at how closures have a large impact on how we write JavaScript.
3
+
4
+
## Assignment Description
5
+
6
+
* Fork/Clone this repository.
7
+
* Complete all the exercises as described inside each assignment file.
8
+
* Use `console.log()` statements to check to see if your code does what it is supposed to do.
9
+
* To test your `console` statements you can either run `node /assignments/<fileName>` and see what prints in your terminal. You can also use an online tool like `JSBin`, `REPL.it`, `JSFiddle` or even your `Chrome developer console`.
10
+
* Once you finish the exercises in each file, commit your code, and push it to your fork.
11
+
12
+
### Array Methods
13
+
Use .forEach(), .map(), .filter(), and .reduce() to loop over an array with 50 objects in it. The [array-methods.js](assignments/array-methods.js) file contains several challenges built around a fund rasising 5k fun run event.
14
+
15
+
* Read the instructions found within the file carefully to finish the challenges.
16
+
* The last challenge is to come up with 3 problems to solve and then build a solution for them using any of the array methods listed above.
17
+
* Share one of your favorite problem/solutions in your team meeting.
18
+
* Complete each challenge presented before moving on to closure.
19
+
20
+
### Closures
21
+
The [closure.js](assignments/closure.js) assignment showcases how variables can be used outside of functions to store state using closure.
// A local community center is holding a fund rasising 5k fun run and has invited 50 small businesses to make a small donation on their behalf for some much needed updates to their facilities. Each business has assigned a representative to attend the event along with a small donation.
2
+
3
+
// Scroll to the bottom of the list to use some advanced array methods to help the event director gather some information from the businesses.
// 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.
58
+
letfullName=[];
59
+
console.log(fullName);
60
+
61
+
// ==== Challenge 2: Use .map() ====
62
+
// 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
63
+
letallCaps=[];
64
+
console.log(allCaps);
65
+
66
+
// ==== Challenge 3: Use .filter() ====
67
+
// 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
68
+
letlargeShirts=[];
69
+
console.log(largeShirts);
70
+
71
+
// ==== Challenge 4: Use .reduce() ====
72
+
// 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
73
+
letticketPriceTotal=[];
74
+
console.log(ticketPriceTotal);
75
+
76
+
// ==== Challenge 5: Be Creative ====
77
+
// Now that you have used .forEach(), .map(), .filter(), and .reduce(). I want you to think of potential problems you could solve given the data set and the 5k fun run theme. Try to solve 3 unique problems using one or many of the array methods listed above.
0 commit comments