This repository was archived by the owner on Jan 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 154
London Class 7 - Kara Howard - JavaScript Core 2 - Week 1 #51
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
4d66bc8
Updated Personal Details
kmh256 5925052
Mandatory 1 - Writers Complete
kmh256 45375b2
Update Mandatory 1 - Writers
kmh256 5faabca
Mandatory 2 - Water bottle complete
kmh256 c660c17
Mandatory 3 - Groceries complete
kmh256 d473af4
Mandatory 4 - People I know complete
kmh256 9386437
Mandatory 5 - Recipes complete
kmh256 aaa7e28
Mandatory 6 - Reading List complete
kmh256 c44c27f
Mandatory 7 - Budgets complete
kmh256 485ab99
Mandatory 8 - Cheap dinner complete
kmh256 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -386,7 +386,7 @@ First, I want you to find all of my friends who are 35 or older. | |
|
|
||
| */ | ||
|
|
||
| let thirtyFiveOrOlder = []; | ||
| let thirtyFiveOrOlder = people.filter((friend) => friend.age >= 35); | ||
|
|
||
| /* | ||
| 3) Find the email address | ||
|
|
@@ -395,8 +395,9 @@ Next, I want you to find all of the people who work for "POWERNET" and then stor | |
|
|
||
| */ | ||
|
|
||
| let powerNetEmails = []; | ||
|
|
||
| let powerNetEmails = people.filter(friend => friend.company === "POWERNET") | ||
| .map(friend => friend.email) | ||
| .reverse(); | ||
| /* | ||
|
|
||
| 3) Friends with "Stacie Villarreal" | ||
|
|
@@ -409,7 +410,12 @@ This time, I only want the full names of the people are who friends with her. | |
|
|
||
| */ | ||
|
|
||
| let friendsWithStacie = []; | ||
| let friendsWithStacie = people | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent work here Kara, good use of higher-order functions. |
||
| .filter((person) => person.friends | ||
| .find((friend) => friend.name === "Stacie Villarreal") | ||
| ) | ||
| .map((person) => `${person.name.first} ${person.name.last}`) | ||
| .reverse(); | ||
|
|
||
| /* | ||
|
|
||
|
|
@@ -424,6 +430,13 @@ This time, I only want the full names of the people who can multitask | |
| */ | ||
|
|
||
| let friendsWhoCanMultitask = []; | ||
| people.map((person) => { | ||
| person.friends.map((friend) => { | ||
| if (friend.skills.includes("Multi-tasking")) { | ||
| friendsWhoCanMultitask.push(friend.name); | ||
| } | ||
| }); | ||
| }); | ||
|
|
||
| /* | ||
| ================================================== | ||
|
|
||
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done for using the
forEachmethod and JavaScript string interpolation!A couple of suggestions for small improvements:
writersof the anonymous function (that is, the function without a name that you're passing to theforEachmethod) could instead be namedwriter, in the singular. That's because semantically you are holding the data for only one writer in that variable.ifstatement is excluding writers who are 40 years old; you can use the>=comparison operator to include them.