Skip to content

Commit 1b4063a

Browse files
author
russom
committed
function implemented for checking duplicate items.
1 parent 37e70cb commit 1b4063a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎Sprint-2/implement/tally.js‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
function tally() {}
1+
function tally(arr) {
2+
const count = {};
3+
for (const item of arr) {
4+
count[item] = (count[item] || 0) + 1;
5+
}
6+
return count;
7+
}
28

39
module.exports = tally;

0 commit comments

Comments
 (0)