title: Handling the distinction between undefined- and null-parameters in JavaScript
body: <p>I know very well that null and undefined are distinct in JavaScript. However, I can't seem to decide whether or not use that fact when my own functions are passed one of those as its argument.</p>
  
  <p>Or, expressed in a different way, should <code>myFoo(undefined)</code> return the same thing as <code>myFoo(null)</code>?</p>
  
  <p>Or, in yet another case, since <code>myBar(1, 2, 3)</code> is (almost) the same thing as <code>myBar(1, 2, 3, undefined, undefined)</code>, should <code>myBar(1, 2, 3, null, null)</code> return the same thing as <code>myBar(1, 2, 3)</code>?</p>
  
  <p>I feel that there's potential for confusion in both cases and that a library should probably follow a convention when handling null/undefined. </p>
  
  <p>I'm not really asking for personal opinions (so please express those as comments rather than answers). I'm asking if anyone knows if there is a best practice that one should stick to when it comes to handling this distinction. References to external sources are very welcome!</p>