We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41ddcad commit efa5ce8Copy full SHA for efa5ce8
Sprint-1/destructuring/exercise-2/exercise.js
@@ -70,3 +70,19 @@ let hogwarts = [
70
occupation: "Teacher",
71
},
72
];
73
+
74
+// Task 1: Display names of people in Gryffindor
75
+hogwarts.forEach(({ firstName, lastName, house }) => {
76
+ if (house === "Gryffindor") {
77
+ console.log(`${firstName} ${lastName}`);
78
+ }
79
+});
80
81
+console.log(""); // Just to separate the two outputs
82
83
+// Task 2: Display names of teachers who have pets
84
+hogwarts.forEach(({ firstName, lastName, pet, occupation }) => {
85
+ if (occupation === "Teacher" && pet) {
86
87
88
0 commit comments