title: JavaScript functions executed with different arguments
body: <p>My HTML has a button that runs a function that calls several other JavaScript functions. It looks like this:</p>
  
  <pre><code>&lt;button id="ButtonSearch" onclick="FillAll()"&gt;&lt;/button&gt;
  </code></pre>
  
  <p>The function <code>FillAll()</code> is in file <code>Calls.js</code> and looks like this:</p>
  
  <pre><code>function FillAll()
  {
      var from_date = document.getElementById('FromDate').value;
      var to_date = document.getElementById('ToDate').value;
  
      FillMap();
      FillMap(from_date, to_date);
      FillRadio();
      FillArea();
  }
  </code></pre>
  
  <p>And finally, the actual function <code>FillMap()</code>, which is in file <code>Maps.js</code> and looks like this:</p>
  
  <pre><code>function FillMap(from_date, to_date)
  {   
      alert(from_date);
      var from_date = document.getElementById('FromDate').value;
      var to_date = document.getElementById('ToDate').value;
      // do stuff
  }
  </code></pre>
  
  <p>The odd thing is that <code>FillMap()</code> is being called twice, and the <code>alert</code> pops up twice: the first one is <code>undefined</code> while the second one shows <code>from_date</code>.</p>
  
  <p>Generally speaking, are JavaScript functions different to "regular" functions where the number of arguments would need to match? </p>
  
  <p>In this case, the arguments don't match but the function is still being called.</p>