I am wondering how one would go about removing unique elements from an array. For example:
var arr = [1, 2, 2, 4, 4]
would return [2, 2, 4, 4]
. Where [1, 2, 3]
would return []
because all elements are unique.
I believe I need to check each element with every other element in the array, but I'm not sure how to go about this.
Thanks!