Rio Rio -4 years ago 139
Javascript Question

Finding the max value of an attribute in an array of objects

I'm looking for a really quick, clean and efficient way to get the max "y" value in the following JSON slice:


Is a for-loop the only way to go about it? I'm keen on somehow using

Answer Source
Math.max.apply(Math,{return o.y;}))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download