Kendra Williams - Javascript II - #256
Open
codingforkicksOG wants to merge 9 commits into
Open
Conversation
…ra stuff for no reason
John-Spraul
reviewed
Aug 23, 2018
John-Spraul
left a comment
There was a problem hiding this comment.
- Git stuff
- Completed Assignment
- Stretch problems/goal(s)
You did very well on this assignment, keep up the great work! 🎉 💯
|
|
||
| //displays callback | ||
| const displayCallback = (arr) => { | ||
| console.log(arr); |
There was a problem hiding this comment.
arr is a misleading placeholder, since not everything passed to displayCallback will be an array
| cb(true); | ||
| }else{ | ||
| cb(false); | ||
| } |
There was a problem hiding this comment.
this works 👍
You could also do cb(list.includes(item), without the if/else since .includes returns either true or false
| // 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.forEach(runner => { | ||
| fullName.push(`${runner.first_name} ${runner.last_name}`)}); |
There was a problem hiding this comment.
for readability, better to have it like:
runners.forEach(runner => {
fullName.push(`${runner.first_name} ${runner.last_name}`);
});
| // 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 = []; | ||
| allCaps = runners.map(runner => { | ||
| return runner.first_name.toUpperCase()}); |
| // 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 = []; | ||
| largeShirts = runners.filter(runner => { | ||
| return runner.shirt_size === "L"}); |
| //{"id":50,"first_name":"Shell","last_name":"Baine","email":"[email protected]","shirt_size":"M","company_name":"Gabtype","donation":171}]; | ||
| // Problem 2 | ||
| let intelRunners = []; | ||
| intelRunners = runners.filter(runner => { |
There was a problem hiding this comment.
would have liked to see a map here, instead of using filter again
| const hiKendra = name("Kendra"); | ||
| const hiJohn = name("John"); | ||
| hiKendra(); | ||
| hiJohn(); |
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.
@John-Spraul