I have an object that has another objects inside, and I need to filter the objects by a value inside the second object.
userone:{
name:"user1"
lastname:"uzer1"
task:{
attendance: "1"
taskname: "whatever"
}
}
usertwo:{
name:"user2"
lastname:"uzer2"
task:{
attendance: "0"
taskname: "whatever2"
}
}
I want to get all the users whose attendance is 1
. I have gone only as far as filtering by name
and lastname
, which I can do like this Object.values(userslist).filter(e => e.firstname == 'user1');
But not sure how to get inside the second object and filter by that value.
Also, the task
object does not exist in all the objects.