Skip to content

Completed JS-II - #1

Open
ashafranchi wants to merge 1 commit into
masterfrom
asha-franchi
Open

Completed JS-II#1
ashafranchi wants to merge 1 commit into
masterfrom
asha-franchi

Conversation

@ashafranchi

Copy link
Copy Markdown
Owner

No description provided.

@ashafranchi
ashafranchi requested a review from ayunas June 12, 2019 15:57

@ayunas ayunas 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.

@ashafranchi doing a great job asha. keep it up. and if you can get to the stretch assignments that'll be amazing.

runners.map((runner) => {
allCaps.push(runner.first_name.toUpperCase());
});

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.

this works, but because map returns a new array, just set the runners.map = a varaible, and you don't have to push to allCaps. the way you did it, a forEach() makes more sense to use. with map, it returns a new array.

return total + runners.donation;
}, 0);

ticketPriceTotal.push(donationTotal);

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.

probably not necessary to push the donationTotal value into an array. what's the point of having a single value in an array?

// List all emails
let ListEmail = [];
runners.forEach(function(runner) {
ListEmail.push(runner.email);

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.

usually capital variables refer to constructor functions. so i would keep it lowercase.

Comment thread assignments/callbacks.js
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.
return cb(arr.pop());

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.

good use of .pop here to get the last item.

Comment thread assignments/callbacks.js
test = true;
}
}
return cb(test);

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.

nice classic way of searching for the item.

Comment thread assignments/closure.js
function returnsayHi() {
return sayHi;
}
returnsayHi();

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.

this is a closure in the very basic sense of the word, because the function is reaching outside it's scope and storing it's value inside it's execution context. Usually, when we return a nested function inside another function, we see a better use case for closures.

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