How to sort ascending in the desired format? Given below is the shiftdata and desired output
//data is in the given below format
shiftdata = [
{ 'Name': 'A', 'Data': '57.6' },
{ 'Name': 'B', 'Data': '-10.6' },
{ 'Name': 'C', 'Data': '50.6' },
{ 'Name': 'D', 'Data': '-5.6' },
];
I want to convert it in sort ascending order like(Desired output)
shiftdata = [
{ 'Name': 'B', 'Data': '-10.6' },
{ 'Name': 'D', 'Data': '-5.6' },
{ 'Name': 'C', 'Data': '50.6' },
{ 'Name': 'A', 'Data': '57.6' },
];
Question2: Sort ascending the shiftdata, leaving shiftdata[0] and shiftdata[last] as it is and sort ascend inside.