Guest User

Untitled

a guest
May 7th, 2012
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. Understanding Node.js modules: multiple requires return the same object?
  2. // app.js
  3.  
  4. var a = require('./a');
  5. a.b = 2;
  6. console.log(a.b); //2
  7.  
  8. var b = require('./b');
  9. console.log(b.b); //2
  10.  
  11. // a.js
  12.  
  13. exports.a = 1;
  14.  
  15. // b.js
  16.  
  17. module.exports = require('./a');
Advertisement
Add Comment
Please, Sign In to add comment