I need to return duplicates in a new array and get this output: [1, 2, 5] but get two times 1. why?
const array = [1, 2, 3, 1, 5, 6, 1, 2, 5];
let newArrFiltered = array.filter(
(item, index) => array.indexOf(item) !== index
);
console.log(newArrFiltered); // [1, 1, 2, 5]