I have a categories array:
{id: 1, catName: "test", subCategories: Array(2)}
I need to retrieve the subCategories array based on the id of the category.
This return the entire category object, how can I change it to only return the subCategories array?
const subCategories = categoriesWithSub.filter(category => {
return category.id === departments.catId;
});