I am just learning javascript and was wondering if someone could point me to or explain a good description between a custom data type and a regular class like object?
I was working through a sample code snip below to help me. Is a custom data type and a regular class like type object the same thing? I was confused on this point.
function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.getFullName = function() {
return this.firstName + " " + this.lastName;
};
this.greet = function(person) {
alert("Hello " + person.getFullName());
};
}
var person1 = new Person("Bill", "Smith");
var person2 = new Person("John", "Doe");
person2.greet(person1);
alert(person1.getFullName());
Thanks in advance to all. Is this the answer?