I need to sort an array of objects by the two fields. I need it to be as least computationally heavy as possible.
This is how the array of objects looks
let arr = [
{
name: 'Liate',
surname: 'Tsek'
},
...
]
This is how I am doing it
let unique = [...new Set(arr.map(item => item.name))]
This only works for the 1st field, how can I get it to work with both?