loading...

Discussion on: What’s your alternative solution? Challenge #29

Collapse
tomsfernandez profile image
Tomas Fernandez

With a reduce

function distinct(list = []){
  const reduced = list.reduce((acc, curr) => {
    acc[curr] = curr;
    return acc;
  }, {})
  return Object.values(reduced)
}