I have an array containing rows (tr elements) of a table:
var tbody = document.querySelector("#tasktable tbody");
var rows = [].slice.call(tbody.querySelectorAll("tr"));
Each of these rows has an input date element, in which I've stored each date value in an array and converted the date into a number (originally a string). Ex: "10-24-2021" --> 20211024.
I can easily sort the array of numeric date values in ascending order by:
dateArray.sort(function(a,b){
return a-b;
});
However, I really just want to sort the rows in the table. How do I sort the row array based on the way the date array was sorted, since each date corresponds to the row by their index?
Thank you!