I have seen two ways of creating instances:
Method 1
function Contact(first, last) {
this.firstName = first;
this.lastName = last;
this.fullName = function() {
return this.firstName + " " + this.lastName;
};
}
Method 2
var Associate = function(first, last) {
this.firstName = first;
this.lastName = last;
this.fullName = function() {
return this.firstName + " " + this.lastName;
};
};
Are there any benefits of the first over the other?
What is the correct terminology for these? I believe they are supposed to be called "Object Constructor Functions" but I have also seen them called classes.