Repository navigation
Conversation
AlexEntrepreneur
left a comment
There was a problem hiding this comment.
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 tasksas 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`); |
| 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 |
| // console.log(callBack); | ||
| // }); | ||
| contains('Gum', items, (callBack) => { | ||
| console.log(callBack); |
There was a problem hiding this comment.
Interesting way of doing this. 👍
|
|
||
| function contains (item, list, cb) { | ||
| if (item === list[i]) { | ||
| return cb(list[i]); |
There was a problem hiding this comment.
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`); |
There was a problem hiding this comment.
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 👍
No description provided.