Created
April 14, 2012 01:30
-
-
Save westoque/2381346 to your computer and use it in GitHub Desktop.
Pop the question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Animal = function() { | |
EventEmitter.call(this); | |
}; | |
util.inherits(Animal, EventEmitter); | |
//////////////////////////////////// | |
// QUESTION AREA | |
//////////////////////////////////// | |
// Why does this break?? | |
Animal.prototype = { | |
talk: function() { | |
console.log('Woof'); | |
} | |
} | |
// And This doesn't? | |
Animal.prototype.talk = function() { | |
console.log('Woof!'); | |
} | |
//////////////////////////////////// | |
simba = new Animal(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment