How does JavaScript determine if an array index is integer?
<p>It seems that JavaScript's array indexes are actually all strings, so <code>a[0]</code> is the same as <code>a['0']</code> while <code>a[1.0]</code> is not <code>a[1]</code> but <code>a['1.0']</code>.
But at the same time, array has a length property; it will be updated automatically when you modify value of integer keys. So how does JavaScript know the key is an integer and it needs to change length?
If I do:</p>

<pre><code>var a = 4/2;
var b=8/4; 
var c = 2; 
var d= 1*2;
</code></pre>

<p>are <code>arr[2], arr[0+2], arr[1*2], arr[a], arr[b], arr[c], arr[d]</code> same thing?</p>

<p>We often access array in a loop like this:</p>

<pre><code>for (i=0; i&lt;100; i++) {
  arr[i]=1;  // this is a[0],a[1] right?
  arr[i+0.0]=1;  // is this a[0] or a['0.0'] ?
}
</code></pre>

<p>If I write this:</p>

<pre><code>for (i=0.1; i&lt;100; i+=0.1) {
  arr[i*10]=1;  // what does it do?  a[1] = 1, a[1.0]=1 or a[1.00000] = 1 ?
}
</code></pre>

<p>what does the assignment in the loop do?</p>
