Skip to content

Commit 08bab4d

Browse files
committed
finished iteration ironhack-labs#5
1 parent 47e7cf5 commit 08bab4d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/functions-and-arrays.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,23 @@ const wordsUnique = [
132132
"bring",
133133
];
134134

135-
function uniquifyArray() {}
135+
function uniquifyArray(wordsArray) {
136+
if (wordsArray.length == 0) {
137+
return null
138+
}
139+
const uniquifiedArray = [];
140+
141+
for (let i = 0; i < wordsArray.length; i++) {
142+
const word = wordsArray[i];
143+
144+
if (uniquifiedArray.indexOf(word) === -1) {
145+
uniquifiedArray.push(word);
146+
}
147+
}
148+
return uniquifiedArray
149+
}
150+
151+
136152

137153
// Iteration #6: Find elements
138154
const wordsFind = [

0 commit comments

Comments
 (0)