I have an array with some various information in it regarding state traits and need to modify it in a few ways. First I need to sort it by area then by name if the area is the same. So I use parseInt to get the actual int instead of the string but now I'm lost. How do I pull off this sort? I also need to find the most populated / least populated states and store that in variables.
(function() {
'use strict';
var states = [{
"name": "Alaska",
"area": "663,268 sq mi",
"population": 735132
}, {
"name": "California",
"area": "163,696 sq mi",
"population": 38332521
}, {
"name": "oregon",
"area": "98,381 sq mi",
"population": 3899353
}, {
"name": "washington",
"area": "71,300 sq mi",
"population": 6971406
}];
var moddedStates = {};
for (var i = 0; i < states.length; i++) {
var area = parseInt(states[i].area);
}
}());