Get max for more than one object property
<p>I have code that finds the max of two properties, but I don't know that it's the best way to do this. I am inside jQuery's <code>$.getJSON(URI, function(json){})</code> call.</p>

<p>The goal is to make a bar chart with 2 bars that's exactly the width of the longest bar.</p>

<p>Currently to find the maximum value:</p>

<pre class="lang-js prettyprint-override"><code>var max = Math.max.apply(this, $.map(json, function(d){
    return Math.max(d.bar1, d.bar2);
}));
</code></pre>

<p>Is there a better way?</p>

<p>Edit: A json string, as requested:</p>

<pre><code>[
    {
        "bar1": "15",
        "bar2": "13"
    },
    {
        "bar1": "20",
        "bar2": "25"
    },
    {
        "bar1": "10",
        "bar2": "18"
    }
]
</code></pre>

<p><code>max</code> should be equal to 25 with this as an input.</p>
