-
-
Save diegodfsd/1342388 to your computer and use it in GitHub Desktop.
cumulative export example
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
// node.js exercise | |
function privateSay(message) { | |
console.log("private: ", message); | |
}; | |
function say(message) { | |
console.log("public: ", message); | |
}; | |
function User(name) { | |
this.name = name; | |
}; | |
function create(name) { | |
count += 1; | |
return new User(name); | |
}; | |
function count() { | |
var accumulated = 0; | |
return function(){ | |
accumulated += 1; | |
return accumulated; | |
}; | |
}; | |
// from now on I decide what to export | |
exports.say = say; | |
exports.User = User; | |
exports.create = create; | |
exports.count = count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment