filterNonUnique
Creates an array with the non-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 unique values.