// A method to find a duplicate value in an array and the index of the duplicates
// array can be any data type
const arry = ["1", "2", "3", "1"];
let set = new Set();
for (let i = 0; i < arry.length; i++) {
let pastSize = set.size;
set.add(arry[i]);
let newSize = set.size;
if (pastSize == newSize) {
console.log("The array has duplicates at index: ", i);
}
}