Exclude variables from object
<p>So basically I understand you can loop through an array in either of these ways.</p>

<pre><code>var testarray = new Array(1,2,3,4);
for(i in testarray)console.log(testarray[i]);
//outputs 1,2,3,4
for(var i=0;i&lt;testarray.length;i++) console.log(testarray[i]);
//outputs 1,2,3,4
</code></pre>

<p>My question how can I duplicate/emulate that array.  With support for both of the for loop methods?  Because when I do the same thing but I create my own function it includes length in the 1st for loop.</p>

<pre><code>function emulatearray(){
     for(var i = 0;i&lt;arguements.length;i++)this[i]=arguments[i];
     this.length = i;
}                       
var testarray = new emulatearray(1,2,3,4);
for(i in testarray)console.log(testarray[i]);
//outputs 1,2,3,4,null
for(var i=0;i&lt;testarray.length;i++) console.log(testarray[i]);
//outputs 1,2,3,4
</code></pre>
