Skip to content

Instantly share code, notes, and snippets.

@krlicmuhamed
Created March 27, 2015 22:56
Show Gist options
  • Save krlicmuhamed/e57f9a15b4dc90258ed2 to your computer and use it in GitHub Desktop.
Save krlicmuhamed/e57f9a15b4dc90258ed2 to your computer and use it in GitHub Desktop.
Node.js Module
// 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