I have a two functions one is Person and another Employee. Person is parent class and employee should be inherited class. Employee should inherit age and name from Person and should have employerName as its own property.
Person // age, name
Employee //age, name, employerName
I have written the function Person as:
function Person(age,name){
this.age = age;
this.name = name;
}
How to write the employee function: I tried like this:
function Employee(employerName ){
this.employerName = employerName ;
}
Employee.prototype = new Person(10,'Jack');
var p1 = new Person(10, 'Jack');
How to write the employee function so as to create the instances like this(how to pass the reference of Person object):
e1 = new Employee(25, 'John', 'eBay');
e2 = new Employee(26, 'John-1', 'XYZ');