Skip to content

Jennifer King - JavaScript II - #244

Open
pghrogue wants to merge 8 commits into
bloominstituteoftechnology:masterfrom
pghrogue:master
Open

Jennifer King - JavaScript II#244
pghrogue wants to merge 8 commits into
bloominstituteoftechnology:masterfrom
pghrogue:master

Conversation

@pghrogue

@pghrogue pghrogue commented Aug 16, 2018

Copy link
Copy Markdown

Task 1: Set Up The Project With Git

  • Fork the project into your GitHub user account
  • Clone the forked project into a directory on your machine
  • You are now ready to build this project with your preferred IDE
  • Use 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.

  • Review the contents of the callbacks.js file. Notice you are given an array at the top of the page. Use that array to aid you with your callback functions. Remember that a callback function is a function that is being passed around to other functions.
  • Write out each function using the ES5 function keyword syntax.
  • Solve the problems listed. Save the stretch problems until you have completed Tasks 1-4.

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.

  • Review the contents of the array-methods.js file.
  • Complete the problems provided to you
  • Notice the last three problems are up to you to create and solve. This is an awesome opportunity for you to push your critical thinking about array methods, have fun with it.

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.

  • Review the contents of the closure.js file.
  • Solve the problems listed. Save the stretch problems until you have completed Tasks 1-4.
  • Once you have completed this task please submit a pull request against the original fork.

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

@kiachoi kiachoi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ What Went Well:

  • Callbacks - love the extra function created
  • Array Methods
  • Closures
  • Arrow Function Syntax
  • Stretch Goals

🎗 Recommendation(s):

  • All in all, I have nothing more to say! This was very well done.

Other:

  • 3/3

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 );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be elem.donation > 200 since it is asking for companies who donated over $200.

Comment thread assignments/callbacks.js
const items = ['Pencil', 'Notebook', 'yo-yo', 'Gum'];

function display(item) {
console.log(item);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice helper function!

Comment thread assignments/callbacks.js

for( let i = 0; i < array.length; i++ )
{
if( newArr.includes(array[i]) === false ){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified to if (!newArr.includes(array[i])) as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants