-
-
Save dutradotdev/16b9464d1af1755e60f488da1c12c525 to your computer and use it in GitHub Desktop.
Exemplo de namespace
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 cokePkt = cokePkt || {}; | |
cokePkt.greeting = { | |
hi: function hi() { | |
console.log('hi'); | |
}, | |
hello: function hello() { | |
console.log('hello'); | |
} | |
}; | |
// Se você estiver no navegador, o cokePkt é appendado no Window. | |
// Se você estiver no Node.js, o cokePkt é appendado no Object Global. | |
// Para executar, basta digitar no console: | |
// cokePkt.greeting.hi(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment