Geeks With Blogs

News


Rohit Gupta Engaging talk on Microsoft Technologies ....My Resume
December 2015 Entries
Creating a prototype chain in Javascript
We just need to implement three concepts to build a prototype chain in Javascript. First we create the base class: function Animal(voice){ this.voice = voice || grunt; } //We update the Animal prototype so that it has a function that can be used by all its derived classes Animal.prototype.speak = function(){ console.log(this.voice); } //Next we create our derived class, whose constructor calls the constructor of the base class //in this case the Derived class is Cat and base class is Animal function ......

Posted On Monday, December 21, 2015 1:36 AM

Copyright © Rohit Gupta | Powered by: GeeksWithBlogs.net