Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript prototype inheritance example

function Person(first, last, age, gender, interests) {
  this.name = {
    first,
    last
  };
  this.age = age;
  this.gender = gender;
  this.interests = interests;
};

function Teacher(first, last, age, gender, interests, subject) {
  Person.call(this, first, last, age, gender, interests);

  this.subject = subject;
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #prototype #inheritance
ADD COMMENT
Topic
Name
2+2 =