title: JavaScript - Modify arguments before executing function
body: <p>Given I have a function called <code>sum</code> module imported from a 3rd party module <code>Calculator</code>. Here's how I use it:  </p>
  
  <pre><code>Calculator.sum(1, 2) // returns 3  
  </code></pre>
  
  <p>I don't know the implementation of <code>Calculator.sum</code>. What if I want to modify the arguments passed to <code>Calculator.sum</code> before executing <code>sum</code>, so that instead of taking the original numbers (1, 2, 3, etc), <code>sum</code> will take their squared values (1, 4, 9, etc) ? For example:  </p>
  
  <pre><code>Calculator.sum(1, 2) // returns 5
  Calculator.sum(2, 3) // returns 13
  Calculator.sum(3, 4) // returns 25
  </code></pre>
  
  <p><strong>Note:</strong> This is just an example of my actual problem, I don't actually need a <code>Calculator.sum</code> function to calculate sum of squares </p>