Skip to content

Commit 4204a37

Browse files
committed
use Object.create(null) to avoid inherited property conflicts in tally.
1 parent b1c7edb commit 4204a37

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(items) {
33
throw new Error("Input must be an array");
44
}
55

6-
const result = {};
6+
const result = Object.create(null);
77

88
for (const item of items) {
99
if (result[item]) {

0 commit comments

Comments
 (0)