I have to sort this:
I'm taking data from a db from two different select query and I have to sort them by mpriority and by mdate.
I know how to sort array of objects, but I cannot use object nor object.key
    var allocations = new Array(); 
    allocations[0] =
    [   qtA =  15,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp=  11,
        mpriority=  5,
        mdate=  new Date('2017-04-27 11:26:02.147'),
    ];
allocations[1] =
    [
        qtA= 13,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp= 11,
        mpriority= 5,
        mdate= new Date('2016-10-07 00:00:00.000'),
    ];
allocations[2] =
    [
        qtA= 16,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp= 11,
        mpriority= 4,
        mdate= new Date('2017-04-27 11:26:02.147'),
    ];
allocations[3] =
    [
        qtA= 95,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp= 11,
        mpriority= 1,
        mdate= new Date('2016-10-06 00:00:00.000'),
    ];
allocations[4] =
    [
        qtA= 75,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp= 11,
        mpriority= 8,
        mdate= new Date('2017-02-20 12:41:34.903'),
    ];
allocations[5] =
    [
        qtA= 45,
        mdata=  '1234',
        mid =  '234234234',
        qtyToDoTemp= 11,
        mpriority= 0,
        mdate= new Date('2017-04-27 11:26:02.147'),
    ];
The sort function should look at first at mpriority - if two value are the same then check mdate
I think it would be something like this
var sortOptions = {
    byPriorityAndDate: function (a, b) {
        return (b.mpriority - a.mpriority) || (a.mdate - b.mdate);
    },
}
and how to check wich version of js i'm working on ?
 
     
     
     
    