Dyamically adding function to how hierarchy Nov 24, 2008 • Fred Yang We can add functionality to whole hierarchy by changing the prototype, for example. function Animal() { var r = {}; return r; } var a = new Animal(); Object.prototype.greet = function() { alert("hello"); }; a.greet(); Please enable JavaScript to view the comments powered by Disqus.