Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Organization(name) {
- this.name = name;
- }
- Organization.prototype.greet = function() {
- return 'Hello We are ' + this.name + '!!';
- }
- function Company(name) {
- Organization.call(this, name);
- }
- Company.prototype = Object.create(Organization.prototype);
- Company.prototype.constructor = Company;
- var bizreach = new Company('engineers');
- console.log(bizreach instanceof Company); // true
- console.log(bizreach instanceof Organization); // true
- console.log(bizreach.greet());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement