Guest User

Untitled

a guest
Sep 20th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. function alias(fname) {
  2. return function() {
  3. return this[fname].apply(this, arguments);
  4. };
  5. };
  6.  
  7.  
  8. function Animal() {};
  9. Animal.prototype.sound = null;
  10. Animal.prototype.animalSound = function() {
  11. return this.sound;
  12. };
  13.  
  14.  
  15. function Dog() {};
  16. Dog.prototype = new Animal();
  17. Dog.prototype.sound = 'bark';
  18. Dog.protoype.bark = alias('animalSound');
Add Comment
Please, Sign In to add comment