-
-
Notifications
You must be signed in to change notification settings - Fork 73
ITP-Jan 2025 | London | Chi Mbah | Module-Data-Flows | Week 10 | Sprint 1 | Array Destructuring #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
console.log("QTY ITEM TOTAL"); | ||
|
||
let total = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best practice to declare variables that are not reassigned as 'const' instead of 'let'.
Can you review your variable declarations that are not reassigned and change them to const?
Here is a video you can watch: https://youtu.be/RE6qf3As-XU?si=_YaiEPeBC5Cx_j56
|
||
console.log("Gryffindor Members:"); | ||
|
||
hogwarts.forEach(({ firstName, lastName, house }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works really well! 👏
Something you can do (only a suggestion) is to use .filter
to only keep the records where house === "Gryffindor", before .forEach
.
This will make your code more concise.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
(The same could be done to filter and only keep teachers who have pets in task 2 below)
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.