JavaScript Apply
<p>There's an example in <a href="http://rads.stackoverflow.com/amzn/click/193398869X" rel="nofollow">Secrets of the JavaScript Ninja</a> that provides the following code to get around JavaScript's <code>Math.min()</code> function, which requires a variable-length list.</p>

<pre><code>Example: Math.min(1,2,3,4,5);
</code></pre>

<p>But, there's a problem if you have a <code>list: [1,2,3,4,5]</code>, since you'd rather not have to loop through the list, keeping track of the current min.</p>

<p>The book says to use the following code to solve this issue.</p>

<pre><code>function smallest(arr) {
   return Math.min.apply(Math, arr);   
}

alert(smallest([1,2,3,4,5,6,-33]));
</code></pre>

<p>What happens with <code>Math.min.apply(Math, arr)</code> under the hood? </p>
