I have the following array of objects. I need to obtain the properties of the item which has the highest MoveCount. I have a function which returns me only the MoveCount. But I want to get the value of Latitude and Longitude as well.
The function I used is as follows:
var res = Math.max.apply(Math,movers.map(function(o){ return o.MoveCount, o.Latitude, o.Longitude;})) alert('Max y = ' + res); Objects:
var movers = [{"MoveCount":3,"DepartureCountryCode":"MG","Latitude":-18.766947,"Longitude":46.869107}, {"MoveCount":2,"DepartureCountryCode":"MU","Latitude":-20.348404,"Longitude":57.552152}, {"MoveCount":4,"DepartureCountryCode":"ZA","Latitude":-30.559482,"Longitude":22.937506}];