Skip to content

Instantly share code, notes, and snippets.

@miladvafaeifard
Created February 3, 2019 12:34
Show Gist options
  • Save miladvafaeifard/04c4e822ff40b477efedae1e2e7879c1 to your computer and use it in GitHub Desktop.
Save miladvafaeifard/04c4e822ff40b477efedae1e2e7879c1 to your computer and use it in GitHub Desktop.
modular function in plain js
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