--- al01/17.js
+++ al01/17.js
... | ... | @@ -7,14 +7,13 @@ |
7 | 7 |
} |
8 | 8 |
|
9 | 9 |
for(let i = 0; i < arr.length; i++){ |
10 |
- for(let k = arr.length; k > i; k--){ |
|
10 |
+ for(let k = arr.length-1; k > i; k--){ |
|
11 | 11 |
if(arr[i] == arr[k]){ |
12 | 12 |
arr.splice(k, 1); |
13 | 13 |
} |
14 | 14 |
} |
15 |
+ console.log(arr[i]); |
|
15 | 16 |
} |
16 |
- return arr; |
|
17 |
- |
|
18 | 17 |
} |
19 | 18 |
|
20 |
-console.log(solution(["good", "time", "good", "time", "student"]));(No newline at end of file) |
|
19 |
+solution(["good", "time", "good", "time", "student"]);(No newline at end of file) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?