There is an array emails
having few attributes To, From, Subject, Description
. I retrieve records from database and populate all rows in this array. I use to access all rows as follows:
for (var i = 0; i < emails.length; i++) {
var To = emails[i].To;
var Sender = emails[i].Sender;
var Subject = emails[i].Subject;
var Description = emails[i].Description;
}
Now I need to sort this array alphabetically by To
values and store the sorted emails in another array sortedemails
. How can I do this in easiest possible way in Javascript/JQuery?
Thanks.