Easy
This question is a daily question and will count towards your daily streak.
What is the value of summary after the reduce function runs?
1const items = [2 { category: 'fruit', name: 'apple', count: 10 },3 { category: 'fruit', name: 'banana', count: 5 },4 { category: 'vegetable', name: 'carrot', count: 7 },5 { category: 'fruit', name: 'orange', count: 8 },6 { category: 'vegetable', name: 'broccoli', count: 3 },7];89const summary = items.reduce((acc, item) => {10 if (!acc[item.category]) {11 acc[item.category] = 0;12 }13 acc[item.category] += item.count;14 return acc;15}, {});