Object Creation
// Create the constructor for a //Person object
function Person( name ) {
this.name = name;
}
// Add a new method to the Person //object
Person.prototype.getName = function() {
return this.name;
};
// Create a new User object constructor
function User( name, password ) {
this.name = name;
this.password = password;
};
// The User object inherits all of the Person object's //methods
User.prototype = new Person();
// We add a method of our own to the User object
User.prototype.getPassword = function() {
return this.password;
};