Skip to content

Commit fd66ffe

Browse files
committed
Done Iteration ironhack-labs#5: Unique Arrays.
1 parent 5b0c9be commit fd66ffe

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/functions-and-arrays.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,18 @@ const wordsUnique = [
142142
'bring'
143143
];
144144

145-
function uniquifyArray() {}
145+
function uniquifyArray(array) {
146+
if (array.length === 0 ){
147+
return null
148+
}
149+
let uniquiteArray = []
150+
for (let i = 0; i < array.length; i++){
151+
if (uniquiteArray.indexOf(array[i]) === -1) {
152+
uniquiteArray.push(array[i])
153+
}
154+
}
155+
return uniquiteArray
156+
}
146157

147158

148159

0 commit comments

Comments
 (0)