I am new to web development. Here, I do have an array which is like 
[{
        endOffset: "50"
        startOffset: "25"
        type: "Education"
    },
    {
        endOffset: "67"
        startOffset: "55"
        type: "address"
    },
    {
        endOffset: "65"
        startOffset: "59"
        type: "project"
    },
    {
        endOffset: "80"
        startOffset: "70"
        type:"fullname"
    }]
In this array of objects , now I am sorting it on the basis of the endoffsets . Which is like ->
jsonDataArray.sort(function (a, b) {
            return a.startOffset - b.startOffset;
          });
Then Its giving me the sorted array. But here it is sorting on the basis of only startoffset. 
What I want is that I want to have an array like which will have sort on ascending order of both start and endoffset, so that the array will be like
[{
 starOffset: "25",
 type: "Education"
}, {
 endOffset: "50"
 type: "Education" },
{
 startoffset: "55"
 type: "address" },
{
 startoffset: "59"
 type: "project" },
{
 endoffset: "65"
 type: "project" },
{
 endoffset: "67"
 type: "address" 
},
{
 endoffset: "67"
 type: "address" 
},
{
 startOffset: "70"
 type: "address" 
},
{
 endoffset: "80"
 type: "address" 
},
]
So, How can I do this ? Can any one please help me with this ?
 
     
     
    