Message from JavaScript discussions

December 2020

β€” IndexOf in the Array prototype is also useful, check it too🀀

β€” 

So, cherry pick as you call it, seem to be a tricky operation by its nature, repo state cant be changed to that commit

β€” [...new Set(arr)] or am I cheating

β€” That removes duplicates

β€” _.difference(arr, new Set(arr))

β€” Identify duplicates, remove others

β€” Or arr.reduce((acc, i, ind) => arr.lastIndexOf(i) === ind || acc.includes(i) ? acc : [...acc, i], [])

Message permanent page

β€” If I have [1, 1, 1] should I get [1]?

β€” No. You should get [ 1, 1, 1]

β€” Oh

β€” You just have to remove unique elements

β€” Boring.. now i understand why reduce is used