Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 26th, 2012  |  syntax: JavaScript  |  size: 0.23 KB  |  views: 45  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. a.js
  2. ------
  3.  
  4. function A() { }
  5. A.prototype.func = function() { console.log('Hello from A'); }
  6.  
  7. function test() {
  8.     new A().func();
  9. }
  10.  
  11. test();
  12. module.exports = new A();
  13.  
  14.  
  15. b.js
  16. ----
  17.  
  18. var A = require('./a');
  19.  
  20. A.func();
clone this paste RAW Paste Data