Skip to content

Brandon Hopper#28

Closed
Hopperb wants to merge 4 commits intobloominstituteoftechnology:masterfrom
Hopperb:master
Closed

Brandon Hopper#28
Hopperb wants to merge 4 commits intobloominstituteoftechnology:masterfrom
Hopperb:master

Conversation

@Hopperb
Copy link

@Hopperb Hopperb commented Apr 17, 2018

Completed array-methods

console.log(fullName);

runners.forEach(function(item){
fullName.push(`${item.first_name} ${item.last_name}`)
Copy link

Choose a reason for hiding this comment

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

Perfect.

console.log(allCaps);

runners.map(function(item){
return allCaps.push(item.first_name.toLocaleUpperCase());
Copy link

Choose a reason for hiding this comment

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

toUpperCase please, I know vscode suggests toLocaleUpperCase but compare and contrast the two in the documentation.

Copy link

Choose a reason for hiding this comment

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

And you're doing too much, either return or push. Here a return would be appropriate because map returns a new array.

let ticketPriceTotal = [];

runners.reduce(function(item1, item){
return ticketPriceTotal.push(item1 + item.donation);
Copy link

Choose a reason for hiding this comment

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

I'd like you to try this again.

let donationsUnder = [];

runners.filter(function(item){
return donationsUnder.push(item.donation < 150);
Copy link

Choose a reason for hiding this comment

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

I'd like you to try this again, and seek disambiguation.

let newEmail = [];

runners.map(function(item){
return newEmail.push(item.email);
Copy link

Choose a reason for hiding this comment

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

And this one too.

let allCompanies = [];

runners.forEach(function(item){
allCompanies.push(item.company_name);
Copy link

Choose a reason for hiding this comment

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

👍

let largeShirts = [];

runners.filter(function(item){
return largeShirts.push(item.shirt_size !== "L");
Copy link

Choose a reason for hiding this comment

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

Filter has a return, use that for your assignment not a push.

});

// Problem 3 No newline at end of file
console.log(allCompanies); No newline at end of file
Copy link

Choose a reason for hiding this comment

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

All in all on this page, I'd like you to spend more time in the documentation before you use the available methods. Very close but some mixing of paradyms, I'm not even suprised though, I expect it.

return newProfile;
}
let newGreeting = profile();
console.log(newGreeting());
Copy link

Choose a reason for hiding this comment

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

Looks good. 👍

const newCounter = counter();
console.log(newCounter());
console.log(newCounter());
console.log(newCounter());
Copy link

Choose a reason for hiding this comment

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

👍

console.log(reverseNewCounterFactory());
console.log(reverseNewCounterFactory());
console.log(newCounterFactory());
console.log(reverseNewCounterFactory()) No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Functionally equivilent but I'd instead try using

counterFactory.increment = counterFactory();
counterFactory.decrement = reverseCounter();
``` to salvage the composition
But what we were looking for is the counterFactory to return an object that contains the functions increment and decrement.


const sum = exampleArray.map(x => x * 3);

console.log(sum); No newline at end of file
Copy link

Choose a reason for hiding this comment

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

This page is great, 💯

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Somethings to address but don't beat yourself up. It'll make sense sooner or later. 👍 Keep up the great work but I'd like you to pair program with someone whom you've never worked with today to keep it fresh.

@mixelpixel mixelpixel closed this May 21, 2018
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