Polymorphism in Java Script
Polymorphism The ability to call the same method on different objects and have each of them respond in their own way is called polymorphism. Polymorphism is the main pillar of Object Oriented Programming, it refers to the ability of an object to provide different behaviors in different state of objects. Example Parent class Human define a function of introduction() in which it contains simple introduction but Student object override it by adding more detailed information for introduction. So now Human() object has its own implementation of introduction and Student() has its own. It will be invoked according to the state of object. //Define human class function Human(fullName) { this.fullName = fullName; } // Add a couple of methods to Human.prototype Human.prototype.speak = function(){ alert("I speak English!"); }; Human.prototype.introduction = function(){ alert("Hi, I am " + this.fullName); }; //Defi...