You will use the arr.filter to find the duplicated array, then return a array, after that, you will

use the Set to remove the repeat item in the array and return this array out

Checking for duplicate strings in JavaScript array

Remove duplicate values from JS array [duplicate]