title: Javascript check arguments for zero value
body: <p>I'm writing a function that checks if arguments are zero, and it doesn't seem to work correctly. Note: Using Chrome as my browser, but this code should be cross-browser supported.</p>
  
  <pre><code>// check all arguments, and make sure they aren't zero
  
  function zeroCheck(arg1, arg2) {
      var i, argsLen = arguments.length;
      for (i = 0; i &lt;= argsLen; i += 1) {
          if (arguments[i] === 0) {
              // This is where it doesn't behave as I expected
              arguments[i] = 1; // make arg1 = 1
          }
      }
      console.log(arg1); // arg1 = 0
  }
  
  zeroCheck(0, 2);
  </code></pre>
  
  <p>I was expecting <code>arg1</code> to be equal to <code>1</code>, but it is still equal to <code>0</code>.</p>