2👍
✅
You pass name already here:
filteredByCategory(category.name)
But then try access name property again in filter function.
product.category === category.name
Change one of those lines
- Pass category object to –
filteredByCategory(category)
- Or check category instead
product.category === category
2👍
Dot notation actually is accepted with the ES6
function({ propHere })
other than that I see that you already pass the category.name to the function filteredByCategory
, but you are still using category.name
. So it becomes like ‘clothing’.name which is undefined, because string prototype doesn’t have such method.
Source:stackexchange.com