What is the Best Way To Define Object Memeber and Please Explain Why
1 : 1st Way
var Obj = {
M1 : 1,
M2 : 2
}
Using it like
Obj.M1
2 :2nd Way
var Obj = function(){
if (!(this instanceof Obj ))
return new Obj ();
}
Obj.prototype.M1 =1 ;
Obj.prototype.M2 =2 ;
Using it Like
Obj().M1;
i mean with all that is using prototype better than defining the whole members with in these {} ?