Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function alias(fname) {
- return function() {
- return this[fname].apply(this, arguments);
- };
- };
- function Animal() {};
- Animal.prototype.sound = null;
- Animal.prototype.animalSound = function() {
- return this.sound;
- };
- function Dog() {};
- Dog.prototype = new Animal();
- Dog.prototype.sound = 'bark';
- Dog.protoype.bark = alias('animalSound');
Add Comment
Please, Sign In to add comment