One possible solution is to use the filter() method to iterate over the objects in Obj1 and return only those that have at least one filter that is also present in checkedFilters. Here's an example implementation:
const filteredObj1 = Obj1.filter(obj => {
return obj.filters.some(filter => checkedFilters.includes(filter));
});
This code creates a new array filteredObj1 that contains only the objects from Obj1 that meet the filter criteria. The filter() method takes a callback function that is called for each object in Obj1. The callback function returns true if the object should be included in the filtered array, and false otherwise.
In this case, the callback function checks if any of the filters in the current object (obj.filters) are present in the checkedFilters array. This is done using the some() method, which returns true if at least one element in the array satisfies the provided testing function. The testing function simply checks if the current filter is included in checkedFilters.
If the some() method returns true, it means that the current object has at least one filter that is also present in checkedFilters, so the callback function returns true and the object is included in the filtered array. If some() returns false, the callback function returns false and the object is excluded from the filtered array.
Note that this implementation assumes that Obj1 and checkedFilters are both arrays of objects/numbers, respectively, as shown in the question description. If the actual data structures are different, the code may need to be adapted accordingly.