Prototype Inheritance
javascript
by Kumaresan S
JavaScript
function plant(name, age){
this.name = name;
this.age = age;
}
plant.prototype.earth = function(){
console.log(this.name + this.age);
}
plant.prototype.moon = function(){
console.log(this.name +" moon " + this.age);
}
var one = new plant("world" ,"23");
var two = new plant("light" ,"23");
console.log(two.moon());