Skip to content

Instantly share code, notes, and snippets.

@cannelflow
Created May 2, 2016 16:00
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 cannelflow/469c2b33e3c72187156f7baf463ef5e2 to your computer and use it in GitHub Desktop.
Save cannelflow/469c2b33e3c72187156f7baf463ef5e2 to your computer and use it in GitHub Desktop.
type 1
//app.js code
var app1 = require("./Component/app1.js")
console.log(app1);
//app1.js code
var app = "Hello From app1.js"
module.exports = app;
type 2
//app.js code
var app1 = require("./Component/app1.js")
console.log(app1.app);
//app1.js code
var app = "Hello From app1.js"
module.exports.app = app;
both works fine but unlike in second case we are using app from module.exports.app = app; to app.js like console.log(app1.app);
we are not using app from module.exports = app; in app.js file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment