Skip to content

Commit 14817ee

Browse files
committed
Filter the array by house:Gryffindor
1 parent 2b2114e commit 14817ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sprint-1/destructuring/exercise-2/exercise.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,9 @@ let hogwarts = [
7070
occupation: "Teacher",
7171
},
7272
];
73+
function gryffindorHouse(hogwarts){
74+
return hogwarts.filter(({house})=>house==="Gryffindor");
75+
}
76+
console.log(gryffindorHouse(hogwarts))
77+
//and display the names of the people who belong to the Gryffindor house.
78+
//- Use object destructuring to extract the values you need out of each element in the array.

0 commit comments

Comments
 (0)