How to overload functions in javascript?
<p>Classical (non-js) approach to overloading:</p>

<pre><code>function myFunc(){
 //code
}

function myFunc(overloaded){
 //other code
}
</code></pre>

<p>Javascript wont let more than one function be defined with the same name. As such, things like this show up:</p>

<pre><code>function myFunc(options){
 if(options["overloaded"]){
  //code
 }
}
</code></pre>

<p>Is there a better workaround for function overloading in javascript other than passing an object with the overloads in it?</p>

<p>Passing in overloads can quickly cause a function to become too verbose because each possible overload would then need a conditional statement. Using functions to accomplish the <code>//code</code> inside of those conditional statements can cause tricky situations with scopes.</p>
