I have a function that takes an array of objects and I need to sort the array by day; it looks like this:
function Myfunction (TheDays) {
var TheDaysToSort = $.extend(false, TheDays);
function SortOrder (a, b) {
var Day1 = a['TheDate'];
var Day2 = b['TheDate'];
return Day1 - Day2;
};
TheDaysToSort.sort(SortOrder);
}
I get an error Uncaught TypeError: Object #<Object> has no method 'sort'