I was writing tiny code and attempted to get all unique values of an array.
I totally forgot the best implementation, but I thought my first 2 implementations use some interesting code golfing techniques.
The html file demonstrates its uses on an array of primitive values.
a.reduce((p,o)=>p.find(q=>q==o)?p:[...p,o],[])This is the least efficient and longest implementation, but I used the spread operator to add each element.
π Method 2 (43b): Using an Object {}, set each value to its attribute and then get its Object.keys.
Object.keys(a.reduce((p,o)=>(p[o]=1,p),{}))π Method 3 (22b): Using the Set Global Object and it will convert the array into its unique values
The Array.from method turns the object into an array.
Array.from(new Set(a))This is probably the most efficient since it's a Global Object built into the browser.