How to Pass Parameter to array.map()? : <p>I am trying to map values to a function that will accept two numbers to multiply but am having trouble doing so (if this doesn't make sense, take a look at the examples below).</p>

<p>I have an array of numbers and I would like to double/triple/quadruple... the values of this array. I have created functions that would do this, and am feeding these <code>double()</code> and <code>triple()</code> into <code>map()</code>.</p>

<pre><code>var arr = [1, 2, 3, 4, 5];

function double(num) {
  return num * 2;
}

function triple(num) {
  return num * 3;
}

console.log( arr.map(double) );
console.log( arr.map(triple) );
</code></pre>

<p>This solution is not scalable as what if I want to multiply the values by 5, or 10? I need a more abstract function that would take a parameter of what to multiply. I am confused about how to do this. My attempt so far is:</p>

<pre><code>var arr = [1, 2, 3, 4, 5];

function multiply(num, multiplyBy) {
  return num * multiplyBy;
}

console.log( arr.map(multiplyBy(4) ); // Uncaught TypeError: NaN is not a function
</code></pre>

<p>How would I pass <code>multiply()</code>  the <code>multiplyBy</code> parameter?</p>
