-
-
Save dutradotdev/b1304bb7cece6252e0f643670fcb0493 to your computer and use it in GitHub Desktop.
Revealing Module Pattern
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
(function(global){ | |
const idade = 21; | |
const cpf = 13412312321; | |
function meuNomeQueSeraExposto() { | |
return 'Lucas'; | |
} | |
function meuNomeQueNaoSeraExposto() { | |
return 'Lucas Muniz Dutra'; | |
} | |
global.lucas = { | |
nome: meuNomeQueSeraExposto, | |
idade, | |
} | |
}(this)); | |
/* | |
no console: | |
lucas.nome // 'Lucas' | |
lucas.idade // 21 | |
lucas.cpf // undefined pois não exportamos este dado | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment