I have a dictionary where key is string and value is array of objects:
objDict = {
dataset1: [ { id: 1, count: 6 }, { id: 2, count: 7 }, { id: 3, count: 8 } ],
dataset2: [ { id: 1, count: 5 }, { id: 2, count: 4 }, { id: 3, count: 3 } ]
}
I need to filter objects with specific id
and create an array of count
values: for id = 2
it would be countArray = [ 7, 4 ]
.
I suppose I should first use Object.values(objDict)
but I don’t know what to do afterwards.