Skip to content

Instantly share code, notes, and snippets.

@westoque
Created April 14, 2012 01:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westoque/2381346 to your computer and use it in GitHub Desktop.
Save westoque/2381346 to your computer and use it in GitHub Desktop.
Pop the question
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