Skip to content

Commit 6499f68

Browse files
committed
Fix tally.js
1 parent 1c843d4 commit 6499f68

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎Sprint-2/implement/tally.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ function tally(input) {
88
}
99

1010
for (const i of input) {
11-
if (out[i] === undefined) {
11+
if (!Object.hasOwn(out, i)) {
1212
out[i] = 1;
13-
} else if (out[i].hasOwnProperty(i)) {
13+
} else {
1414
out[i] = out[i] + 1;
1515
}
1616
}
1717

1818
return out;
1919
}
2020

21+
console.log(tally(["a", "a", "b"]));
22+
2123
module.exports = tally;

0 commit comments

Comments
 (0)