title: How to override default parameter in JavaScript
body: <p>I've found lots of creative ways to set default parameters in ES5 &amp; ES6 but I have yet to see a simple example of how to override default parameters in JavaScript. Take this example:</p>
  
  <p><code>new Connection(host, port = 25575, password, timeout = 5000)</code></p>
  
  <p>The default timeout is fine but the port number is not. When calling this function, JavaScript always treats the second parameter as the <code>password</code> parameter:</p>
  
  <pre><code>myConnection = connFactory.getConnection(process.env.IP,
                                           process.env.PORT,
                                           process.env.PASSWORD)
  </code></pre>
  
  <p>This code results in an authentication error because the second parameter is assumed to be <code>password</code>. How can I override the default parameter for <code>port</code> <strong>without</strong> modifying the original function definition?</p>