Last active
August 4, 2018 09:12
-
-
Save rafagarcia/336c2fc711b7662d8eb9ba966fd8fd5e to your computer and use it in GitHub Desktop.
private-public-methods-exposure
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
var module = (function(){ | |
/* simple método privado */ | |
var privateMethod = function(){ | |
console.log("soy un método privado"); | |
}; | |
/* retornando un objeto literal */ | |
return{ | |
publicMethod : function(){ | |
privateMethod(); | |
console.log("soy un método publico"); | |
} | |
} | |
})(); | |
/* accediendo nuestro método publico */ | |
module.publicMethod(); | |
module.privateMethod(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment