StackOverflow love

My first post on hashnode. Many of us depend on StackOverflow for solving day to day minor programming challenges. During these times, over the years, I have come across various gems of code. Let me start with my favorite piece of code I came across for the Javascript/Nodejs developers.

Filtering unique values in an array, attributed to this thread

myArray.filter((v, i, a) => a.indexOf(v) === i);

Yes, a lot of users have provided solutions including using the newer Set syntax. But I love the simplicity and power of the above one liner. Typically, while we know the filter method allows three arguments (value, index and array), we usually use only the value parameter and occasionally the index parameter. The brilliant use of the third array parameter to achieve uniqueness is what I love about this.