Skip to content

Daren Larson#439

Open
darenlarson wants to merge 4 commits intobloominstituteoftechnology:masterfrom
darenlarson:master
Open

Daren Larson#439
darenlarson wants to merge 4 commits intobloominstituteoftechnology:masterfrom
darenlarson:master

Conversation

@darenlarson
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@ashwins93 ashwins93 left a comment

Choose a reason for hiding this comment

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

Really good job getting all the tasks done. Would really love to see you go for the stretch goals. Good job with the git commits.

// 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 = [];
runners.map(function(item) {
allCaps.push(item.first_name.toUpperCase());
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It is not quite how we would use a map function. The callback to the map function should return a transformed element from the original element and the map function itself returns a new array filled with the transformed elements. This is how we would typically use it

 let allCaps = runners.map(function (runner) {
  return runner.first_name.toUpperCase();
});

// Problem 2
// Add the first name, last name, and company name together.
let NameCompany = [];
runners.forEach(function(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.

map may have better suited for this particular task.

}
if(list.includes(item)) {
return cb(true);
} else cb(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.

The else is not necessary here as we are returning inside if clause

// Return a function that when invoked increments and returns a counter variable.
let count = 0;

return () => (++count);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Really good use of arrow function to write terse code.

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