Skip to content

Commit 9d7a1c0

Browse files
committed
ironhack-labs#5 + tests are Done
1 parent b15a34f commit 9d7a1c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/functions-and-arrays.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ console.log(averageNumbers(numbersAvg));
8686

8787

8888
// Level 2: Array of strings
89-
9089
const wordsArr = ['seat', 'correspond', 'linen', 'motif', 'hole', 'smell', 'smart', 'chaos', 'fuel', 'palace'];
9190
function averageWordLength(item) {
9291
if (item.length === 0) {
@@ -120,6 +119,14 @@ const wordsUnique = [
120119
'simple',
121120
'bring'
122121
];
122+
function uniquifyArray(uniqArray) {
123+
let uniqSet = null;
124+
if (uniqArray.length) {
125+
uniqSet = uniqArray.filter((c, d) => uniqArray.indexOf(c) === d)
126+
}
127+
return uniqSet
128+
}
129+
console.log(uniquifyArray(wordsUnique))
123130

124131
// Iteration #6: Find elements
125132
const wordsFind = ['machine', 'subset', 'trouble', 'starting', 'matter', 'eating', 'truth', 'disobedience'];

0 commit comments

Comments
 (0)