What is the difference between these two methods of declaring an object, from which you can make an instance? Are there pros and cons to each?
//Method 1:
var myThing1 = function(){
this.a= 2,
this.m = function() {
return this.a + 1;
}
}
var myThing1Instance = new myThing1();
//Method 2:
var myThing2 = {
a: 2,
m: function() {
return this.a + 1;
}
};
var myThing2Instance = Object.create(myThing2)