Skip to content

Commit f92ea8a

Browse files
committed
Complete callback stretch
1 parent d92cf34 commit f92ea8a

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

assignments/callbacks.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,15 @@ contains("Gum", items, function(index, input) {
8686

8787
/* STRETCH PROBLEM */
8888

89+
const logDeDuped = (array) => console.log(array);
8990
function removeDuplicates(array, cb) {
91+
let mirrored = [...array];
92+
let deDupe = mirrored.filter((x, i, thisArr) => {
93+
return thisArr.indexOf(x) == i;
94+
})
95+
cb(deDupe);
9096
// removeDuplicates removes all duplicate values from the given array.
9197
// Pass the duplicate free array to the callback function.
9298
// Do not mutate the original array.
9399
}
100+
removeDuplicates(["test", "test", "duplicateTest", "test"], logDeDuped);

0 commit comments

Comments
 (0)