Create property in OOP JavaScript
<p>i found 2 define for property in OOP javascript ,which is correct?</p>

<ol>
<li>define property inner current object with private field(with var)</li>
<li>define property in prototype object with public field(with this)</li>
</ol>

<p>i think first is more like to c# property?</p>

<pre><code>  function Pet() {

               this._age = 0;                       //second public feild

               _name = 'm2';                         //first private feild
              this.get_name= function () {          //first define
                    return _name;
                }

                set_name= function (value) {
                    this._name = value;
                }
            }


            Pet.prototype = {
                speak: function () {                        
                    throw Error.notImplemented();
                },

                get_age: function () {          //second define
                    return this._age;
                },
                set_age: function (value) {
                    if (isNaN(value) || value &lt; 0) {
                        throw Error.argument('age');
                    }
                    this._age = 0;
                }
            }

            Pet.registerClass('Pet');

            var pet = new Pet();
            var u = d.get_name();
</code></pre>
