Javascript function declaration with same arguments : <p>I am learning javascript myself. I found if I declare a function with same arguments it just working fine:</p>

<pre><code>function func(a, b, a){
  return b;
}
alert(func(1,2,3));
</code></pre>

<p>But if I do this :</p>

<pre><code>function func(a, b, a = 5){
  return b;
}
alert(func(1,2,3)); 
//Firebug error - SyntaxError: duplicate argument names not allowed in this context
</code></pre>

<p>Then its not working anymore. What is the logic behind that it was working for first equation but not for second one ?</p>
