Last active
September 2, 2019 13:07
-
-
Save ansarisufiyan777/bde88242ca8f4b8ce1165c2e4182b212 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
//Module design patterns | |
exports.RunModular = () => { | |
Employee = (() => { | |
var emp = []; | |
console.log("Modular Pattern:", this) | |
// I am private | |
function privateFunction() { | |
console.log("Private function") | |
} | |
// I am public | |
function push(name) { | |
emp.push(name) | |
} | |
// I am public | |
function fetch() { | |
return emp; | |
} | |
return { | |
add: push, | |
fetch: fetch | |
} | |
})(); | |
console.log(Employee.add("A1")) | |
console.log(Employee.add("A2")) | |
console.log(Employee.add("A3")) | |
console.log(Employee.fetch()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment