Skip to content

Meera andersen - #1

Open
meera-andersen wants to merge 2 commits into
masterfrom
meera-andersen
Open

Meera andersen#1
meera-andersen wants to merge 2 commits into
masterfrom
meera-andersen

Conversation

@meera-andersen

Copy link
Copy Markdown
Owner

Finished all challenges

@meera-andersen
meera-andersen requested a review from clem9281 May 7, 2019 22:36

@clem9281 clem9281 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

2:star:
Fantastic job, really solid work. I had a couple of suggestions, but overall it looks great!

// 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 = [];
console.log(fullName);
let fullName = runners.forEach(function(currentValue){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let fullName = runners.forEach(function(currentValue){
runners.forEach(function(currentValue){

forEach has no return value, unlike map.

let fullName = [];
console.log(fullName);
let fullName = runners.forEach(function(currentValue){
// console.log(currentValue.first_name, currentValue.last_name);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// console.log(currentValue.first_name, currentValue.last_name);
fullName.push(`${currentValue.first_name} ${currentValue.last_name}`);

So since forEach doesn't have a return value, we have to manually populate the fullName array

// console.log(currentValue.first_name, currentValue.last_name);
});

// console.log(fullName);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// console.log(fullName);
console.log(fullName);

Right now this is undefined, after you follow my suggestion it should contain the correct answer



// Problem 3
let fidel = runners.filter(currentValue => currentValue.last_name === "Fidel");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
let fidel = runners.filter(currentValue => currentValue.last_name === "Fidel");
let fidel = runners.filter(currentValue => currentValue.first_name === "Fidel");

Fidel is someone's first name in the array

Comment thread assignments/callbacks.js

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

So they were looking for these questions to be answered in a little bit of a different format than what you have here, but you correctly demonstrated using HOFs with callbacks

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