score:2

Accepted answer
const uniqueValues = new Set();
data.forEach(record => uniqueValues.add(record.rank._type));
console.log(uniqueValues);

score:0

const data = [{"name":"Ankh of Anubis","rank":{"_type":"medal","current":"ankh-of-anubis"}},{"name":"Bonus Roulette","rank":{"_type":"medal","current":"bonus-roulette"}},{"name":"jetx","rank":{"_type":"medal","current":"jetx"}},{"name":"Gates of Olympus","rank":{"_type":"trophy","current":"gates-of-olympus"}},];

const uniqueValues = new Set(data.map(elem => elem.rank._type));
uniqueValues.forEach(value => console.log(value));

score:0

const data = [
  {
    "name": "Ankh of Anubis",
    "rank": {
      "_type": "medal",
      "current": "ankh-of-anubis"
    }
  },
  {
    "name": "Bonus Roulette",
    "rank": {
      "_type": "medal",
      "current": "bonus-roulette"
    }
  },
  {
    "name": "jetx",
    "rank": {
      "_type": "medal",
      "current": "jetx"
    }
  },
  {
    "name": "Gates of Olympus",
    "rank": {
      "_type": "trophy",
      "current": "gates-of-olympus"
    }
  },
]

const result = data.filter((item, index) => {
  const itemIndex = data.findIndex(i => i.rank._type === item.rank._type)
  return itemIndex === index
})

console.log(result)

score:0

Array.from(new Set(dataList.map(i => i.name)))

score:1

const unique = [...new Set(data.map(item => item.rank._type))];

Related Query

More Query from same tag