JS prototype vs closure
<p>I have a JavaScript object that does something like this - using a closure to simulate private vs public functions/variables:</p>

<pre><code>var myCoolObject = function(x, y) {

    var prop1 = "a cool prop1 value";
    var negX = x * -1;
    var negY = y * -1;
    var xyProduct = x * y;

    return {
      PublicProp1: prop1,
      getXYProduct: function() { return xyProduct; },
      getNegX: function() { return negX; },
      getNegY: function() { return negY; }
    }
}
</code></pre>

<p>I will be creating around 4000 instances of this object, and from what I am reading adding functions via the <code>prototype</code> will be more efficient than adding them as I have above (because in my example, each instance will have it's own <code>getXYProcust()</code>, <code>getNegX()</code> and <code>getNegY()</code> functions.</p>

<p>My question is twofold - is my approach above really "inefficient"?  I realize that inefficient is a relative term - but is this something I will likely notice.  If it is inefficient, how would I add those functions to the <code>prototype</code> of <code>myCoolObject</code>?  I tried the following:</p>

<pre><code>myCoolObject.prototype.protoProp = "pppp";
myCoolObject.prototype.getAtMeBro = function () { return "get at me bro"; };
var myInstance = new myCoolObject(5, 10);
</code></pre>

<p>But neither <code>protoProp</code> nor 'getAtMeBro()' are properties of <code>myInstance</code> when I inspect it.</p>

<p>Thanks in advance for any help - I appreciate it!</p>
