Js gets duplicates in the array

the array is as follows

[
{checked: true, index: 0}
{checked: true, index: 1}
{checked: true, index: 2}
{checked: true, index: 3}
{checked: true, index: 4}
{checked: true, index: 5}
{checked: true, index: 1}
]

output

[checked:true, index: 1]
Mar.04,2022

const arr = [
  {checked: true, index: 0},
  {checked: true, index: 1},
  {checked: true, index: 2},
  {checked: true, index: 3},
  {checked: true, index: 4},
  {checked: true, index: 5},
  {checked: true, index: 1}
]

const mapper = {}
const newArr = []

for (let item of arr) {
  const {index, checked} = item
  if (mapper[index]) {
    newArr.push(item)
  } else {
    mapper[index] = true
  }
}

console.log(newArr)

const a = [
    {checked: true, index: 0},
    {checked: true, index: 1},
    {checked: true, index: 2},
    {checked: true, index: 3},
    {checked: true, index: 4},
    {checked: true, index: 5},
    {checked: true, index: 1}
]

const result = Array.from(a.reduce((m, t) => m.set(t.place, t), new Map()).values());
Menu