JavaScript: Use Object As Array
<p>Are there any pitfalls to code like this?</p>

<pre><code>var Foo = function() {
    this.bar = function() { return 'bar'; };
};

var f = new Foo();
f[0] = 'hi';
f[1] = 'there';
</code></pre>

<p>Note that I'm creating a new function object with some misc properties, and then I'm treating the object like an array. Also how are the array values being stored in the object? Are 0 and 1 treated like property names?</p>
