Uncaught TypeError: .sort is not a function ?!
So i've done some ajax calls and wanted to sort my results and ran into the error:
Uncaught TypeError: resultData.sort is not a function
This is because the returned data is an object and jQuery's sort function only works on array. So the solution is to map the object to an array:
var resultArray = $.map(resultData, function(value, index) { return [value]; });
resultArray.sort().reverse();
Now you can sort or manipulate your data as an array! Easy-peasy.