How can I sort these arrays (from array with most amount of items inside to least)? I think the logic is there but there are methods I am missing. Output shows nothing.
//Declare Variables
var TN = ['Chattanooga', 'Nashville', 'Memphis'],
FL = ['Tampa', 'Miami', 'Orlando', 'Clearwater'],
GA = ['Atlanta', 'Marietta'];
//write function to sort array from most to least
function sortStates(a, b){
return a - b;
}
//Make an object to get total in each array.
var stateTotal = {
totalTN: TN.length,
totalFL: FL.length,
totalGA: GA.length
};
//Sort states in order
stateTotal.sort(sortStates);
console.log(stateTotal);
Desired Output: totalFL: 4, totalTN: 3, totalGA: 2