4 ms·
It's probably this in JS: categories .filter( category => category.Name.includes('food')) .flatMap(category => { const productGroup
by 11235813213455 7y ago
It's probably this in JS:
categories
.filter(
category => category.Name.includes('food'))
.flatMap(category => {
const productGroup = products.filter(product => product.CategoryID === category.ID);
return productGroup.length === 0 ? [] : [{
Name: category.Name,
MostExpensive: products.reduce((a, b) => a.Price < b.Price ? b : a)
}];
})