Sort an array of objects
Given an array of city data. Write a function that takes an array of objects as a parameter. Sort the objects by population in desc order. Display the newly sorted array.
Extra Credit:
Sort the city data by the population ascending order
Sort the city data by the city name
Sort the city data by median age
City | State | Population | Median Age | Avg Household Size |
---|
