Skip to content

Christopher adams#1

Open
cladams0203 wants to merge 7 commits intomasterfrom
christopher-adams
Open

Christopher adams#1
cladams0203 wants to merge 7 commits intomasterfrom
christopher-adams

Conversation

@cladams0203
Copy link
Copy Markdown
Owner

No description provided.

@cladams0203 cladams0203 requested a review from blokboy April 20, 2019 02:03

function last(arr, cb) {
// 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.

.pop() actually modifies the array by removing the last element it returns. Is this desired behavior?

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.
return cb(list.includes(item));
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

@cladams0203
Copy link
Copy Markdown
Owner Author

cladams0203 commented Apr 22, 2019 via email


// ==== Challenge 4: Use .reduce() ====
// 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 = [];
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.

See if you can turn 82-85 into one line

Hint: let ticketPriceTotal = runners.reduce(...) it returns a single value but you can cast it to an array multiple ways

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