Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

Js3/week3/davinder #55

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
V3.3 week3
Completed the texercise-3 in exercises.
  • Loading branch information
davappler committed Sep 14, 2020
commit 8bd54479780535767c58d487e8269faf3dc9c62c
22 changes: 22 additions & 0 deletions week-3/Homework/mandatory/2-exercises/exercise-2/exercise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,25 @@ let hogwarts = [
{ firstName: "Minerva", lastName: "McGonagall", house: "Gryffindor", pet: null, occupation: "Teacher" },
{ firstName: "Albus", lastName: "Dumbledore", house: "Gryffindor", pet: "Phoenix", occupation: "Teacher" }
]


function GryffindorHouse(hogwarts)
{
for(let i=0;i<hogwarts.length;i++)
{
// console.log(hogwarts[i]);
let {firstName,lastName,house,pet,occupation}=hogwarts[i];
if(house==="Gryffindor")
console.log(firstName+" "+lastName);
}
console.log(" \n ")
for(let i=0;i<hogwarts.length;i++)
{
let {firstName,lastName,house,pet,occupation}=hogwarts[i];
// console.log(" \n ")
if(pet!=null)
console.log(firstName+" "+lastName);
}
}

GryffindorHouse(hogwarts);