title: Changing JavaScript function's parameter value using arguments array not working
body: <p>I am learning JavaScript and am pretty confused about the <code>arguments</code> property array.</p>
  
  <p>I have a function that takes a single argument and returns it. When I pass the parameter and reassign it using <code>arguments[0] = value</code>, it's updating the value.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function a(b) {
    arguments[0] = 2;
    return b;
  }
  console.log(a(1)); //returns 2</code></pre>
  </div>
  </div>
  </p>
  
  <p>But when I call the same function with no parameters it returns <code>undefined</code>.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function a(b) {
    arguments[0] = 2;
    return b;
  }
  console.log(a()); //returns undefined</code></pre>
  </div>
  </div>
  </p>
  
  <p>But even if I pass <code>undefined</code>, the value will update as well.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function a(b) {
    arguments[0] = 2;
    return b;
  }
  console.log(a(undefined)); //returns 2</code></pre>
  </div>
  </div>
  </p>
  
  <p>I thought that if you do not pass a parameter to a JavaScript function, it automatically creates it and assigns the value to <code>undefined</code> and after updating it should reflect the updated value, right?</p>
  
  <p>Also <code>a()</code> and <code>a(undefined)</code> are the same thing, right?</p>