Say for example I have an array of objects with the following basic structure:
{
value1 : "VALUE"
, value2 : "VALUE"
, value3 : "VALUE"
}
Is there a way to sort this array in vanilla JavaScript where it sorts ascending on value1 and value2, but descending on value3? This is just a example of the kind of mixed sort I'm looking at. Pretty anywhere where sorting needs to be done on more than one object value, and it isn't only ascending or descending, but both.
For a bit of reference, I'm trying to build a results list and grant the user the ability to choose which values they want to sort on, and whether those values are sorted ascending or descending prior to being returned to the user.