0
votes

I am creating a filter for a diagram. Whenever a filter is clicked it should remove that category from the diagram. The api call returns an object with names. let’s say the object returns 40 items and I want to filter 5 out by name. What is the best way to approach this?.

I tried to manually type the property names into an array and run the .filter on my object like below. However it returns the entire object unfiltered.

filterDiagram() {

    Const array = [“all the names of the properties I want to filter out”]
    
    carbonates = array.forEach(x) => {console.log(x)}
    
    Const filterCat = data.filter (io => 
    io.name !== carbonates)

}