Created
September 3, 2019 04:08
-
-
Save rohanBagchi/751c68d88d3d2285bd87a4b4a8585ac1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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