javaScript filter nested objects and arrays
问题 My use case is something like this. I have an array that has an object. That each object has an array called menu Again that menu array has objected. That each object has an array dish_has_categories In dish_has_categories array, if there is an object with CategoryId is equal to 8 I want to filter out that root object. My original data object const data = [{ menuName: "Hot dogs", menu: [ { dishId: '1', dish_has_categories: [{ CategoryId: '8' }] }, { dishId: '2', dish_has_categories: [{