filterUnique
Creates an array with the unique values filtered out.
- Use
new Set()
and the spread operator (...
) to create an array of the unique values inarr
. - Use
Array.prototype.filter()
to create an array containing only the non-unique values.