H
howa
Method 1:
var Person = {
name: "",
sayHello: function() {
....
}
}
Method 2:
function Person(name) {
this.name = name;
}
var p = new Person("john");
While both is okay, I see a trend more and more people is using method
1, any reason?
var Person = {
name: "",
sayHello: function() {
....
}
}
Method 2:
function Person(name) {
this.name = name;
}
var p = new Person("john");
While both is okay, I see a trend more and more people is using method
1, any reason?