We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cbcbe64 commit 1962dc2Copy full SHA for 1962dc2
1 file changed
Sprint-2/implement/tally.js
@@ -6,8 +6,9 @@ function tally(arr) {
6
throw new Error("Input must be an array");
7
}
8
9
- // Create an empty obkect to store our counts
10
- const counts = {};
+ // Create an empty object with no inherited properties
+ // This prevents conflicts with built in properties like "toString"
11
+ const counts = Object.create(null);
12
13
// Loop through each item in the array one by one
14
for (const item of arr) {
0 commit comments