Calling Method on an array
<p>Can someone help me understand what is going on in this code?</p>

<pre><code>   function reduce(fn, a, init){

    var s = init;
    for (i = 0; i &lt; a.length; i++)
        s = fn( s, a[i] );
    return s;
}

function sum(a)
{
    return reduce( function(a, b){ return a + b; }, 
                   a, 0 );
}

function join(a)
{
    return reduce( function(a, b){ return a + b; }, 
                   a, "" );
}
</code></pre>

<p>I guess the part that is throwing me of is the b variable and how it is used. Thanks for the help!</p>
