JavaScript "arguments" -passing a function with other parameters
<p>Function <code>multiply</code> below is passed a callback function "addOne". Function multiply returns [3,5,7]. </p>

<p>Since the callback function addOne is one of the arguments of function multiply, and since the arguments of function multiply are all multiplied by 2, why doesnt the callback function itself (i.e. addOne) get multiplied by 2? In other words, instead of function multiply returning <code>[3,5,7]</code>, I would have expected it to return <code>[3,5,7, NAN]</code> since the function is not a number? </p>

<p>Does JavaScript interpreter just somehow know not to multiply it by 2?</p>

<pre><code>function addOne(a) {
return a + 1;
}

function multiply(a,b,c, callback) {
    var i, ar = [];
    for (i = 0; i &lt; 3; i++) {
        ar[i] = callback(arguments[i] * 2);
    }
    return ar;
}



myarr = multiply(1,2,3, addOne);
myarr;
</code></pre>
