Skip to content

Initial PR#179

Open
verydecent wants to merge 6 commits intobloominstituteoftechnology:masterfrom
verydecent:master
Open

Initial PR#179
verydecent wants to merge 6 commits intobloominstituteoftechnology:masterfrom
verydecent:master

Conversation

@verydecent
Copy link

No description provided.

@gooseandmegander
Copy link

Thanks for the PR.

Copy link

@gooseandmegander gooseandmegander left a comment

Choose a reason for hiding this comment

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

Thanks, Wonjae! I've left some comments for you to review.

function getLength(arr, cb) {
// getLength passes the length of the array into the callback.
// getLength passes the length of the array into the callback.
cb(arr);

Choose a reason for hiding this comment

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

If you don't return this value, it will log out as undefined.

function last(arr, cb) {
// last passes the last item of the array into the callback.
// last passes the last item of the array into the callback.
cb(lastIndex);

Choose a reason for hiding this comment

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

lastIndex is a function, and you are not using the argument items given to last. What do you think is going on, and how can you fix it?


function sumNums(x, y, cb) {
// sumNums adds two numbers (x, y) and passes the result to the callback.
cb(x, y);

Choose a reason for hiding this comment

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

There's something you need to do here to get the sum to print or return to the console when you run the file. What needs to happen?

}
}

contains('Pencil', items, listChecker);

Choose a reason for hiding this comment

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

You're currently checking if an item exists in the array and returning true if it does, but you're not returning false if the item does not exist.

// ==== Challenge 1: Use .forEach() ====
// 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 = [];
let fullName = runners.forEach(function(element, index) {

Choose a reason for hiding this comment

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

forEach returns undefined, which is why when you console.log fullName, it comes returns an array of undefined items. How would you mitigate this?

// 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 = [];
let allCaps = runners.map(function(x) {
x.first_name.toUpperCase();

Choose a reason for hiding this comment

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

As is, this exercise is not logging out to the console. Why do you think that is?

// 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 = [];
let largeShirts = runners.filter(function(x) {
if(x.shirt_size === "L";

Choose a reason for hiding this comment

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

As is, this exercise is not logging out to the console. Why do you think that is?

// 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 = [];
let ticketPriceTotal = runners.reduce((reducer, runner) => {
return reducer += runner.donation;

Choose a reason for hiding this comment

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

No need for +=, + works here because the reducer method is already aggregating the results of the return.

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