Skip to content

Commit 0c301ed

Browse files
fix: handle inherited object properties in tally
1 parent cd0ce39 commit 0c301ed

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Sprint-2/implement/tally.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ function tally(items) {
22
if (!Array.isArray(items)) {
33
throw new TypeError("Expected an array");
44
}
5-
const counts = {};
5+
const counts = Object.create(null);
66

77
for (const item of items) {
88
counts[item] = (counts[item] || 0) + 1;

0 commit comments

Comments
 (0)