Forum Discussion
Anjali
5 years agoNew Contributor
Can you please explain how this filter function is working? what is item , pos and a here and how there are related to each other and functioning?
cjhoward18
5 years agoEmployee
Hi @Anjali
item is the current item it is iterating over in the array, pos is the position in the array for this item and a is the array itself.
The expression to remove duplicates is using the indexOf() to collect a single instance of each unique element in the filter() method since indexOf() returns the first found index for each unique value each time.