Forum Discussion
mohamadelmardin
9 years agoNew Contributor III
Thank you. That was helpful :+1:
Thanks @tstack! For anyone wondering what this looks like in the Designer::
Pipeline .slp file: 20170404_mapper-distinct-elements_2017_04_04.slp (3.0 KB)
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?
- cjhoward185 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 anda
is the array itself.The expression to remove duplicates is using the
indexOf()
to collect a single instance of each unique element in thefilter()
method sinceindexOf()
returns the first found index for each unique value each time.