Last active
April 6, 2019 16:51
-
-
Save boombang/2b4e446e9a6c542ba326f47cc82eea95 to your computer and use it in GitHub Desktop.
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
//my-module.js | |
var privateVar = "Ben Cherry"; | |
var publicVar = "Hey there!"; | |
function privateFunction() { | |
console.log( "Name:" + privateVar ); | |
} | |
function publicSetName( strName ) { | |
privateVar = strName; | |
} | |
function publicGetName() { | |
privateFunction(); | |
} | |
module.exposts = { | |
setName: publicSetName, | |
greeting: publicVar, | |
getName: publicGetName | |
} | |
// index.js | |
const myModule = require('my-module'); | |
myModule.setName( "Paul Kinlan" ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment