title: Force missing parameters in JavaScript
body: <p>When you call a function in JavaScript and you miss to pass some parameter, nothing happens.</p>
  
  <p>This makes the code harder to debug, so I would like to change that behavior.</p>
  
  <p>I've seen 
  <a href="https://stackoverflow.com/questions/411352/how-best-to-determine-if-an-argument-is-not-sent-to-the-javascript-function">How best to determine if an argument is not sent to the JavaScript function</a>
  but I want a solution with a constant number of typed lines of code; not typing extra code for each function.</p>
  
  <p>I've thought about automatically prefixing the code of all functions with that code, by modifying the constructor of the ("first-class") Function object.</p>
  
  <p>Inspired by 
  <a href="https://stackoverflow.com/questions/6529195/changing-constructor-in-javascript">Changing constructor in JavaScript</a>
  I've first tested whether I can change the constructor of the Function object, like this:</p>
  
  <pre><code>function Function2 () {
      this.color = "white";
  }
  
  Function.prototype = new Function2();
  f = new Function();
  alert(f.color);
  </code></pre>
  
  <p>But it alerts "undefined" instead of "white", so it is not working, so I've don't further explored this technique.</p>
  
  <p>Do you know any solution for this problem at any level? Hacking the guts of JavaScript would be OK but any other practical tip on how to find missing arguments would be OK as well.</p>