Skip to content

Instantly share code, notes, and snippets.

@Enome
Created May 6, 2012 21:21
Show Gist options
  • Save Enome/2624513 to your computer and use it in GitHub Desktop.
Save Enome/2624513 to your computer and use it in GitHub Desktop.
module.exports = {
bark: function(){
console.log('woof');
},
speak: function(){
this.bark()
}
};
// Test 1
var dog = require('./dog');
dog.speak(); //woof
// Test 2
require('./dog').speak(); //woof
// Test 3
var speak = require('./dog').speak;
speak(); //TypeError: Object #<Object> has no method 'bark'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment