Proper way of setting fields in JavaScript using object prototype
<p>I am trying to figure out the proper way to set up fields of my JavaScript object using prototype.  </p>

<p>I can use the following:</p>

<pre><code>function myData() {};
myData.prototype.a = null;
myData.prototype.b = null;
myData.prototype.c = null;

var data = new myData();
data.a = 1;
data.b = 2;
data.c = 3;
</code></pre>

<p>But, this does not seem to follow proper protocol for encapsulation.</p>

<p>Or, I can do as follows:</p>

<pre><code>function myData() {
    this._a = null;
    this._b = null;
    this._c = null;
};

myData.prototype.__defineGetter__("a", function() {
    return this._a;
});

myData.prototype.__defineSetter__("a", function(val) {
        this._a = val;
});
</code></pre>

<p>This method seems overkill when my getters are just returning the private variable's value and not doing anything with it.</p>

<p>Also, is it correct to set the values to null in the constructor if I don't have the values until later?  i.e. - I set them later.</p>
