Skip to content

Ryan Walker - JavaScript-II - #362

Open
rytwalker wants to merge 6 commits into
bloominstituteoftechnology:masterfrom
rytwalker:master
Open

Ryan Walker - JavaScript-II#362
rytwalker wants to merge 6 commits into
bloominstituteoftechnology:masterfrom
rytwalker:master

Conversation

@rytwalker

Copy link
Copy Markdown

@kamry-bowman kamry-bowman 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.

Great job on this project!

console.log(`Total donations: $${ticketPriceTotal}`);

// ==== Challenge 5: Be Creative ====
// 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 create and then solve 3 unique problems using one or many of the array methods listed above.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Great job with the creativity here!

Comment thread assignments/callbacks.js
});

// Arrow Function
last(items, lastItem => console.log(lastItem));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

how about this? last(items, console.log)

Comment thread assignments/callbacks.js

function contains(item, list, cb) {
// contains checks if an item is present inside of the given array/list.
// Pass true to the callback if it is, otherwise pass 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.

this one has a different pattern from the others. Read carefully what it's asking, and compare to the solution code

function contains(item, list, cb) {
  // contains checks if an item is present inside of the given array/list.
  // Pass true to the callback if it is, otherwise pass false.
  for (let i = 0; i < list.length; i++) {
    if (list[i] === item) {
      return cb(true);
    }
  }
  return cb(false);
}

Comment thread assignments/callbacks.js
// removeDuplicates removes all duplicate values from the given array.
// Pass the duplicate free array to the callback function.
// Do not mutate the original array.
const noDoubles = array.filter((item, index) => array.indexOf(item) >= index);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cool little function

Comment thread assignments/closure.js
};
return counter;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

excellent, looks like you're locked in on closures if you get this one

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