OO Javascript best way to create multiple instances
<p>I am trying to gain more experience using OO JS (apologies for the newbie question in advance) I would like some advice on the following...</p>

<p>The situation is I am trying to make a simple application where 'x' amounts of spans move/bounce across the screen and if any collide it is logged in the console.</p>

<p>I am trying to work out the best way from a performance point of view how to do this. There could be 2 spans, could be 50.</p>

<p>Now I imagine it is best to use a Constructor function as there can be multiple instances (whereas literal is best for 1 instance). Can I then pass the amount of spans as a parameter like this:</p>

<pre><code>var foo = new Foo(50);
</code></pre>

<p>or would I need to do this?</p>

<pre><code>for (var i=0; i&lt;=50; i++) {
 foo[i] = new Foo()
}
</code></pre>

<p>or maybe something else?</p>

<p>I am very concious of trying to get the best performance possible from the script.</p>

<p>Many thanks for any advice.</p>

<p>Regards,
Ad</p>
