I have this project in which I have to sort all the Id and time with a respective button for each of them.
    {
      Id: 1,
      Time: "2022-01-18T14:52:48Z",
    },
    {
      Id: 3,
     Time: "2022-01-18T15:05:28Z",
    },
    {
      Id: 2,
      Time: "2022-01-18T16:57:58Z",
    },
    {
      Id: 0,
     Time: "2022-01-18T16:00:28Z",
    },
  ];
This is the sorting function that I came up with :
    data.sort(function(a, b) {
        return a.Id - b.Id;
      });
    
    data.sort(function(a, b) {
        return a.Time - b.Time;
    });
The problems that I am having is that my button on Click does not trigger data.sort function and I am not able to sort Id and Time at the same time. Any idea?
 
     
    