function findDupes(arr) { for (let i = 0; i < arr.length; i++){ if (hash[arr[i]] === "true"){ dupes.push(arr[i]); } hash[arr[i]] = "true" ; } console.log(dupes); } let arr = [1, 5, 6, 6, 6, 5 ,6 ,7 ,3, 2, 1, 3]; let dupes = []; let hash = {}; findDupes(arr);