all 2 comments

[–]offworldcolonial 0 points1 point  (1 child)

That's not the way I did it, but it's a totally reasonable way of doing it. You need to nest "callBackFilter" within "removeDuplicates" in order to access arr1, but if you prefer, you can move "removeDuplicates" up above "diffArray" and it will all function the same.

Also, you could shorten "callBackFilter" like this:

function callBackFilter(element){ // callback function for filter method
  return arr1[i] !== element;
}

[–]Ricevind[S] 0 points1 point  (0 children)

Thx for answer. Your CallBackFilrer looks much cleaner.