I want to iterate over an array of objects in order to get the oldest person and the youngest person. How could I get that? It looks like an easy task, but there is no way I can get the ages with simple for each loop. Any ideas?
var p = [
{ name : "Billy", age : 5 },
{ name : "Lucy", age : 31 },
{ name : "Jonny", age : 11 },
{ name : "Wolfgang", age : 78 },
{ name : "Robert", age : 23 }
];
I have seen this but it didn't help me in understanding the problem.