function duplicates(arr) {
  const list = []
  const map = {}
  arr.map(item=>{
    if (map[item] == undefined) {
      map[item] = 1
    } else {
      map[item] += 1
      list.push(item)
    }
  })
  return [...new Set(list)]
}