North_West_4 - Terry Calderbank - JavaScript_Module_2 - Week_1#98
North_West_4 - Terry Calderbank - JavaScript_Module_2 - Week_1#98Texx45 wants to merge 9 commits into
Conversation
|
Thanks Terry 1-writer.js Looks great. I'm a fan of arrow functions so like the way you have done that. Note you can chain directly too. Often a matter of preference and readability. One guide is that if you filter into a variable will that variable be used again further down in the code. If not you can chain but yes always consider how readable the code is (by other humans). Too much chaining can also make code obscure.
2-eligible-students.js I take your point in eligibleStudents but your solution is perfectly fine. But how do you do it directly? Think about this
This is a very common pattern - it will certainly keep reappearing. So
3-journey-planner.js Your implementation looks great. Can this also be done without creating a variable and populating it through push? So here is a thought. Get all the locations (they are the keys which you have looped through). Then filter according to the required transport mode. How to get the keys of in object in one go. Like this
So it's a bit of a trick but something like
4-water-bottle.js I can see one or two issues here. Avoid returning something when it's not needed or expected
So we're changing the state of the bottle (object) but not expecting anything back - its just an operation on the bottle. So
More serious are the question functions isFull and isEmpty. So you have
What if the condition fails? It looks like it just falls out of the function without returning so care is needed here. In fact a neat way is simply to return the test, which can be true of false. So
5-groceries.js Wow - a neat trick for removing duplicates with a set and then destructuring. I'm glad you commented otherwise I'd have been puzzled. I never had cause to use sets but yes sets don't have duplicates. Like it. 6-people-I-know.js Much professional looking code in here. Possibilites of chaining filter and map here and there but be guided by clear readable code. 7-recipes.js Does what it says on the tin. Excellent. 8-reading-list.js Again - an array of objects nicely done. On the tin again :-) 9-budget.js Also very good stuff.
This is not to detract from the approach you took which is clear and understandable. More to add to the different ways of dealing with arrays (or lists). 10-cheap-diner.js Great approach - I'm glad you thought about using sort - giving a nice way of doing it. 11-choose-your-own-adventure.js OK - it's good to learn from others. Often it can be really difficult to just get going on something. Where to start. In the real world developers are already working on something that is already there. And the key is to have clear code to help others in that process. All in all a cracking piece of work Terry so thanks for that. Steve |
|
Hi Steve, thanks for the feedback it really helps and is good for reference. I really found this week tough as these were pretty new concept to me and I had only ever seen them in really basic forms, not used on objects or chained for filtering multiple items. I feel I learnt a lot although could have done with another week on them to really drive them home. Once again thanks for taking the time to go through them it really is appreciated! |
|
Your coursework submission has been closed because nobody has interacted with it in six weeks. You are welcome to re-open it to get more feedback. |
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.mdin the root of this repositoryYour Details
Homework Details
Notes
What did you find easy? Nothing
What did you find hard? Everything
What do you still not understand? How to full use the array methods to access objects
Any other notes?
The estimation of 3 hours to complete the homework was way off. It works out at less than 20 mins per exercise, now this is a problem when you are trying to manage your time using the estimates given.
View rendered .github/pull_request_template.md
View rendered GRADING.md
View rendered HOW-TO-GET-HELP.md
View rendered HOW-TO-SUBMIT.md
View rendered HOW_TO_MARK.md
View rendered README.md