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 0787a76 commit 622ebffCopy full SHA for 622ebff
src/functions-and-arrays.js
@@ -96,6 +96,7 @@ function averageWordLength(wordsArr) {
96
// Bonus - Iteration #4.1
97
function avg() {}
98
99
+
100
// Iteration #5: Unique arrays
101
const wordsUnique = [
102
'crab',
@@ -111,7 +112,19 @@ const wordsUnique = [
111
112
'bring'
113
];
114
-function uniquifyArray() {}
115
+function uniquifyArray(wordsNotUnique) {
116
+ if (wordsNotUnique.length === 0){
117
+ return null
118
+ }
119
120
+ let wordsUnique = []
121
+ for (word of wordsNotUnique) {
122
+ if (!wordsUnique.includes(word)) {
123
+ wordsUnique.push(word)
124
125
126
+ return wordsUnique
127
+}
128
129
130
0 commit comments