Skip to content

Commit 7bc6baa

Browse files
committed
fix tally implementation
1 parent 9b6c2ae commit 7bc6baa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sprint-2/implement/tally.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function tally(list) {
33
throw new TypeError("Invalid input: not an array");
44
}
55
return (itemCountMapping = list.reduce((acc, curr) => {
6-
if (typeof curr !== "string" && curr !== "number") {
6+
if (typeof curr !== "string" && typeof curr !== "number") {
77
throw new Error(`Invalid element: ${curr} must be a string or number`);
88
}
99
acc[curr] = (acc[curr] ?? 0) + 1;

0 commit comments

Comments
 (0)