How do I sort an array of objects alphabetically in Typescript. I have array in this format now -
I am looking to sort it alphabetically by the channel field.
Here is what I tried which I got from the web.It didn't show any errors and also it didn't produce the expected result as well.
this.currentPickSelection = this.currentPickSelection.sort((a, b) => {
if (a.channel > b.channel) {
return 1;
}
if (a.channel < b.channel) {
return -1;
}
return 0;
jsonobject is wrong