Created
March 27, 2015 22:56
-
-
Save krlicmuhamed/e57f9a15b4dc90258ed2 to your computer and use it in GitHub Desktop.
Node.js Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Can I do this? | |
//main.js | |
var m = require('./module'); | |
var string = 'Hello from main!'; | |
m.print(); | |
//module.js | |
var prints = function(){ | |
console.log(string); // Should print 'Hello from main!', but It doesn't. | |
// I could pass a variable but I was wondering if this was possible.. | |
} | |
exports.print = prints |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment