foo(bar) and foo(bar, baz) : <p>In ES6, is it possible to have some code like this:</p>

<pre><code>class MyClass
{
     foo(bar)
     {
          console.log(bar + "Bar")
     }
     foo(bar, baz)
     {
          console.log(bar + baz + "Bar baz")
     }
}
</code></pre>

<p>so that when I did:</p>

<pre><code>MyClass.foo("Hello, ", "World and ")
</code></pre>

<p>I would get:</p>

<pre><code>Hello, World and Bar baz
</code></pre>

<p>And I would be able to do:</p>

<pre><code>MyClass.foo("Hello, world!")
</code></pre>

<p>to get:</p>

<pre><code>Hello, world!Bar
</code></pre>

<p>like in Java?</p>
