Skip to content

Commit d827d8e

Browse files
committed
Rewrite using Set
1 parent 29e5f5f commit d827d8e

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

‎Sprint-1/implement/dedupe.js‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
function dedupe(list) {
2-
const seen = {};
3-
const result = [];
4-
5-
for (const item of list) {
6-
if (seen[item] === undefined) {
7-
seen[item] = true;
8-
result.push(item);
9-
}
10-
}
11-
12-
return result;
2+
return Array.from(new Set(list));
133
}
144

155
module.exports = dedupe;

0 commit comments

Comments
 (0)