I am trying to sort array as shown of objects which contains alphanumeric value
[
{ bayid="A1", status=0},
{ bayid="A7", status=0},
{ bayid="A6", status=0},
{ bayid="A5", status=0}
]
i am using the .sort method which is shown below
var sortedArray = modifiedStatusArray.sort(function(a, b) {
return +b.bayid > +a.bayid;
});
but not sure how to sort and get the output as shown below
[
{ bayid="A7", status=0},
{ bayid="A6", status=0},
{ bayid="A5", status=0},
{ bayid="A1", status=0}
]
please help