Jennifer King - JavaScript II - #244
Open
pghrogue wants to merge 8 commits into
Open
Conversation
… calling for, but hopefully, this was it.
goldSponsors (all info about companies who donated > 200 using filter) goldCompanies (capitalized company names using foreach) emailContacts (mapped full names & email addresses)
kiachoi
approved these changes
Aug 20, 2018
| let ticketPriceTotal = []; | ||
| // 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 = runners.reduce( (acc, curr) => acc + curr.donation. 0 ); |
There was a problem hiding this comment.
Check this function out again, you have some syntax issue 😄 But once you fix it, it will return the proper response.
|
|
||
| // Problem 1 | ||
| // Find the companies who donated over $200 to feature these sponsors: | ||
| let goldSponsors = runners.filter(elem => elem.donation >= 200); |
There was a problem hiding this comment.
Should be elem.donation > 200 since it is asking for companies who donated over $200.
| const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum']; | ||
|
|
||
| function display(item) { | ||
| console.log(item); |
|
|
||
| for( let i = 0; i < array.length; i++ ) | ||
| { | ||
| if( newArr.includes(array[i]) === false ){ |
There was a problem hiding this comment.
Can be simplified to if (!newArr.includes(array[i])) as well
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.
Task 1: Set Up The Project With Git
console.log()statements to check your work.Task 2: Callbacks
This task focuses on getting practice with callback functions by giving you an array of values and instructions on what to do with that array.
ES5functionkeyword syntax.Task 3: Array Methods
Use
.forEach(),.map(),.filter(), and.reduce()to loop over an array with 50 objects in it. The array-methods.js file contains several challenges built around a fundraising 5K fun run event.Task 4: Closures
We have learned that closures allow us to access values in scope that have already been invoked.
Hint: Utilize debugger statements in your code in combination with your developer tools to easily identify closure values.
Stretch Goals
Arrow Function Syntax - You will see more and more arrow functions as you progress deeper into JavaScript. Use the function-conversion.js file as a helper challenge to showcase some of the differences between ES5 and ES6 syntax
Look up what an IIFE is in JavaScript and experiment with them