Skip to content

Commit bf6d81e

Browse files
committed
adding some comments to dedupe file
1 parent 8a6c7e1 commit bf6d81e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Sprint-1/implement/dedupe.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
function dedupe(elements) {
22
if (!Array.isArray(elements)) {
3+
// checking if an input is an array
34
return null;
45
}
56

67
let new_array = [];
78
for (let i = 0; i < elements.length; i++) {
9+
// checking if new_array include elements from an elements array
810
if (!new_array.includes(elements[i])) {
11+
// if not push them to new array
912
new_array.push(elements[i]);
1013
}
1114
}

0 commit comments

Comments
 (0)