We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fcf67c2 commit 5a37901Copy full SHA for 5a37901
src/functions-and-arrays.js
@@ -105,3 +105,34 @@ let avg = (arr) => {
105
106
console.log(avg(mixedArr));
107
108
+// Iteration #5: Unique arrays
109
+const wordsUnique = [
110
+ 'crab',
111
+ 'poison',
112
+ 'contagious',
113
+ 'simple',
114
+ 'bring',
115
+ 'sharp',
116
+ 'playground',
117
118
+ 'communion',
119
120
+ 'bring'
121
+];
122
+let uniquifyArray = (arr) => {
123
+ for(let i=0; i< arr.length; i++){
124
+ for (let n=0; n<arr.length;n++){
125
+ if (i !== n){
126
+ if (arr[i] === arr[n]){
127
+ arr.splice(n,1);
128
+ }
129
+ } else{
130
+ continue;
131
132
133
134
+ return `Array updated`;
135
+}
136
+console.log(uniquifyArray(wordsUnique));
137
+console.log(wordsUnique);
138
+
0 commit comments