Get the index of duplicate values except the first

  1. With .map(), add the index of duplicated values into the array. For non-duplicate value, will be added with undefined value [Will be filtered in Step 2].
  2. With .filter(), remove the value which is undefined from the array.

const attD = [1, 2, 3, 4, 3, 3];

const findDuplicates = attD => attD.map((item, index) => {
  if (attD.indexOf(item) !== index)
    return index;
}).filter(x => x);  // Equivalent to .filter(x => x != undefined || x != null)

const duplicates = findDuplicates(attD);
console.log(duplicates);