Skip to content

Commit c22dd28

Browse files
committed
finish wesbos#8
1 parent d933bfc commit c22dd28

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

04 - Array Cardio Day 1/index-START.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
const [bLast, bFirst] = b.split(", ");
158158
return aFirst > bFirst ? 1 : -1;
159159
});
160-
console.log(alphaSort);
160+
// console.log(alphaSort);
161161

162162
// 8. Reduce Exercise
163163
// Sum up the instances of each of these
@@ -177,6 +177,15 @@
177177
"car",
178178
"truck",
179179
];
180+
181+
const sums = data.reduce((newObject, item) => {
182+
if (!newObject[item]) {
183+
newObject[item] = 0;
184+
}
185+
newObject[item]++;
186+
return newObject;
187+
}, {});
188+
console.log(sums);
180189
</script>
181190
</body>
182191
</html>

0 commit comments

Comments
 (0)