filmov
tv
javascript - Finding the max value of an attribute in an array of objects

Показать описание
#short
#javascript
#json
I'm looking for a really quick, clean and efficient way to get the max "y" value in the following JSON slice:
[
{
"x": "8/11/2009",
"y": 0.026572007
},
{
"x": "8/12/2009",
"y": 0.025057454
},
{
"x": "8/13/2009",
"y": 0.024530916
},
{
"x": "8/14/2009",
"y": 0.031004457
}
]
#javascript
#json
I'm looking for a really quick, clean and efficient way to get the max "y" value in the following JSON slice:
[
{
"x": "8/11/2009",
"y": 0.026572007
},
{
"x": "8/12/2009",
"y": 0.025057454
},
{
"x": "8/13/2009",
"y": 0.024530916
},
{
"x": "8/14/2009",
"y": 0.031004457
}
]