Skip to content

Instantly share code, notes, and snippets.

@irridescentrambler
Last active November 3, 2018 07:35
Show Gist options
  • Save irridescentrambler/e47372e4f3db11aab3135af9077ebf83 to your computer and use it in GitHub Desktop.
Save irridescentrambler/e47372e4f3db11aab3135af9077ebf83 to your computer and use it in GitHub Desktop.
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