Created
February 3, 2019 12:34
-
-
Save miladvafaeifard/04c4e822ff40b477efedae1e2e7879c1 to your computer and use it in GitHub Desktop.
modular function in plain js
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
const ModuleA = (function traceA(){ | |
function log(){ | |
console.log(this.foo); | |
} | |
function bar(){ | |
this.foo = 'bar'; | |
log.call(this, null); | |
} | |
bar(); | |
}); | |
ModuleA(); | |
console.log(ModuleA.name); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment