title: Javascript callbacks and optional params
body: <p>If I am creating a function that takes in two mandatory parameters, one is a call back, and a couple optional how can I code it so that when I call it with only the 2 mandatory parameters it works.</p>
  
  <p>Ex:</p>
  
  <blockquote>
    <p>function save(color, size, weight, callback) { ... }</p>
  </blockquote>
  
  <p>Where color and callback are mandatory and size and weight are optional. So if someone wants to call this function with only color and callback...</p>
  
  <blockquote>
    <p>save('blue', function(...) { ... }) { ... }</p>
  </blockquote>
  
  <pre><code> save('blue', 56, function(...) { ... }) { ... }
  </code></pre>
  
  <p>But this assigns the callback function to size and weight, how can I fix this to do what I want?</p>