Javascript II - Completed objectives and stretch goals.#197
Open
ThomasKisner wants to merge 1 commit intobloominstituteoftechnology:masterfrom
Open
Javascript II - Completed objectives and stretch goals.#197ThomasKisner wants to merge 1 commit intobloominstituteoftechnology:masterfrom
ThomasKisner wants to merge 1 commit intobloominstituteoftechnology:masterfrom
Conversation
zackhitch
approved these changes
Aug 9, 2018
zackhitch
left a comment
There was a problem hiding this comment.
Great job with this! The function conversion project will be good practice with more arrow functions, which we'll use mostly moving forward.
| // 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. | ||
| let fullName = []; | ||
|
|
||
| runners.map(function(element){ |
| // ==== Challenge 2: Use .map() ==== | ||
| // 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 | ||
| let allCaps = []; | ||
| let allCaps = runners.map(function(element){ |
| // 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 | ||
| let largeShirts = []; | ||
| console.log(largeShirts); | ||
| let largeShirts = runners.filter((size) => { |
There was a problem hiding this comment.
Great job! This is all that was needed, but good job putting in some extra practice! 😉
| // ==== Challenge 4: Use .reduce() ==== | ||
| // 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 | ||
| let ticketPriceTotal = []; | ||
| ticketPriceTotal = runners.reduce((donation, runner, index, runners) => { |
There was a problem hiding this comment.
Great job here as well. You can remove index and runners, as those are optional parameters, and since they are not used, they shouldn't be there.
| // 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. | ||
|
|
||
| // Problem 1 | ||
| const bigDonors = runners.filter((runner)=>{ |
| @@ -2,33 +2,89 @@ const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum']; | |||
|
|
|||
|
|
||
| function world() { | ||
| const second = "world"; | ||
| console.log(`${first} ${second}`); |
| // ==== Challenge 2: Create a counter function ==== | ||
| const counter = () => { | ||
| // Return a function that when invoked increments and returns a counter variable. | ||
| let numberCount = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.