I have the following filter:
const auxHash = {};
myArray.filter(house =>
house.members === 3 &&
auxHash[house.id] ? false : auxHash[house.id] = true
)
And I get a lint error saying that an arrow function should not return an assignment. I have tried this too:
const auxHash = {};
myArray.filter(house =>
house.members === 3 &&
auxHash[house.id] ? false : (auxHash[house.id] = true)
)
But same problem. How can I solve this?
To clarify. I am trying to filter out elements of an array which attribute members
is different than 3
, and also I am trying to remove duplicate elements based on the attribute id
(that's why I am using the hash).