-
-
Notifications
You must be signed in to change notification settings - Fork 72
ITP-JAN-LONDON|FOROGH AGHAEIYARIJANI|MODULE-DATA-FLOWS|SPRINT 1|DESTRUCTURING|problem-solving-destructuring #179
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
// Task1: Display names of people in Gryffindor | ||
console.log("Gryffindor Members:"); | ||
hogwarts.forEach(({ firstName, lastName, house }) => { | ||
if (house === "Gryffindor") { |
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.
Your code works well 👍
Non-blocking suggestion: If you wanted to improve clarity, you can use .filter
to only include records where house === 'Gryffindor' before running .forEach
.
|
||
// Task2: Display names of teachers who have pets | ||
console.log("\nTeachers with Pets:"); | ||
hogwarts.forEach(({ firstName, lastName, occupation, pet }) => { |
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.
Your code works well 👍
Non-blocking suggestion: If you wanted to improve clarity, you can use .filter
to only include records where occupation === 'Teacher' && pet before running .forEach
.
Learners, PR Template
Self checklist
Changelist
Implemented object destructuring in function parameters and within array iterations.
Added logic to:
Print names of Gryffindor members from the hogwarts array.
Print names of teachers with pets.
Generate a formatted receipt using object destructuring and computed totals.
Ensured output formatting matches the expected result for all tasks.
Questions
Ask any questions you have for your reviewer.