Skip to content

WEB EU2 - JAYNE NORRIE - ALEX E - WEEK 3 GUIDED DAY 2 - #2

Open
jaynecn wants to merge 3 commits into
masterfrom
jaynecn
Open

jaynecn wants to merge 3 commits into
masterfrom
jaynecn

Conversation

@jaynecn

@jaynecn jaynecn commented May 14, 2019

Copy link
Copy Markdown
Owner

No description provided.

@jaynecn
jaynecn requested a review from AlexEntrepreneur May 14, 2019 14:47

@AlexEntrepreneur AlexEntrepreneur left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Jayne this is wonderful stuff! You have demonstrated that you understand the topics by creating and using callbacks and by using array methods. Your code is clear, organised, and easy to understand. Excellent. You have also shown that you are comfortable with the Git workflow

Points of Improvement

  • Complete closures exercise. If you find yourself stuck on an exercise try and move on to the next exercise and come back to it later.
  • More descriptive Git commit messages. A good commit message will inform you of what changes have happened in the commit and will be understandable 6 months from now. We could use Completed array methods tasks as a good message for example.

Overall, you are making excellent progress. Keep going! 🚀

let largeShirts = [];
runners.filter(function(info) {
if (info.shirt_size === "L")
return largeShirts.push(`${info.first_name} ${info.last_name} ordered a Large shirt`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice interpolation 🔥

if (info.company_name === "Skinix")
return companySkinix.push(` ${info.company_name}: ${info.first_name} ${info.last_name}`);
});
console.log(companySkinix); No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good stuff!! 🔥

Comment thread assignments/callbacks.js
// console.log(callBack);
// });
contains('Gum', items, (callBack) => {
console.log(callBack);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Interesting way of doing this. 👍

Comment thread assignments/callbacks.js

function contains (item, list, cb) {
if (item === list[i]) {
return cb(list[i]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here you have not defined what i is so it is giving you an error. The situation that we could potentially have defined i was if we used for loops. Instead, we could check the list for the item using .includes():

if (list.includes(item)) {
  return true;
}
else {
  return false;
}

let partyList = [];
runners.map(function(info) {
if (info.donation > 200)
return partyList.push(`${info.first_name} ${info.last_name} should be added to the guest list`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Here it would be good practice to save runners.map(...) in a variable and reassign partyList like so: partyList = guestListRunners. Using .push() inside of a .map() isn't the best method 👍

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