Skip to content

Instantly share code, notes, and snippets.

@rohanBagchi
Created September 3, 2019 04:08
Show Gist options
  • Save rohanBagchi/751c68d88d3d2285bd87a4b4a8585ac1 to your computer and use it in GitHub Desktop.
Save rohanBagchi/751c68d88d3d2285bd87a4b4a8585ac1 to your computer and use it in GitHub Desktop.
function Employee(name, age, emp_id) {
this.name = name;
this.age = age;
this.emp_id = emp_id;
}
function Accountant(name, age, emp_id) {
Employee.call(this, name, age, emp_id);
this.role = "accountant";
}
Accountant.prototype = Object.create(Employee.prototype);
Employee.prototype.sayName = function() {
return `My name is ${this.name}`;
};
const a = new Accountant("Rohan", "Bagchi", 11234);
document.getElementById("app").innerHTML = `
${a.sayName()}
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment