I need a function that will search/filter the biggest value in a nested array and then return parent scope.
My array looks next:
 data = {"people": 
   [{"male": [
     {"name": "Bob" ,"age": "32"}, 
     {"name":"Mike", "age":"22"}
    ]}, 
   {"female": [
     {"name":"Jessica", "age": "24"}, 
     {"name":"Ann", "age": "23"}
   ]}]} 
And I need to find the biggest age value from all people and then return back male or female array (in example this is male array)
With javascript I can use something like:
largest = array.reduce((x, y) ->
      if x > y then x else y
    )
    console.log largest
but how this can be implement to nested array?
Or is there a way to use angular $filter?
 
     
     
     
    