I have the following array :
public arr = [
{ id: 1, name: 'João das Neves'},
{ id: 2, name: 'Areia Stark'},
{ id: 3, name: 'Sonsa Stark'}
];
I would like to sort this array by the name
attribute, thus:
public arr = [
{ id: 2, name: 'Areia Stark'},
{ id: 1, name: 'João das Neves'},
{ id: 3, name: 'Sonsa Stark'}
];
How to sort a array of objects using TypeScript?