Last active
November 3, 2018 07:35
-
-
Save irridescentrambler/e47372e4f3db11aab3135af9077ebf83 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 Person(name, city){ | |
this.name = name; | |
this.city = city; | |
} | |
Person.prototype.greet = function(){ | |
console.log("Hello my name is " + this.name); | |
} | |
function Developer(name, city, language){ | |
Person.call(this, name, city); | |
this.language = language; | |
} | |
// Assign person's prototype to developer's prototype | |
Developer.prototype = Object.create(Person.prototype); | |
var nikhil = new Developer("Nikhil", "Pune", "Javascript"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment