what is the best way to create a class members in JavaScript
<p>What is the Best Way To Define Object Memeber and Please Explain Why</p>

<p>1 : 1st Way</p>

<pre><code>var Obj = {
           M1 : 1,
           M2 : 2    
}
</code></pre>

<p>Using it like </p>

<pre><code> Obj.M1
</code></pre>

<p>2 :2nd Way </p>

<pre><code>var Obj = function(){
 if (!(this instanceof Obj ))
            return new Obj ();
}
Obj.prototype.M1 =1 ;
Obj.prototype.M2 =2 ;
</code></pre>

<p>Using it Like </p>

<pre><code>Obj().M1;
</code></pre>

<p>i mean with all that is using prototype better than defining the whole members with in these {} ?</p>
