Last active
July 11, 2016 20:52
-
-
Save YurePereira/abdbc9e83f9c3de909076a9a5278cdc5 to your computer and use it in GitHub Desktop.
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
| /** | |
| * Função para criar constantes no JavaScript (ECMAScript 5). | |
| * | |
| * @param name {string} nome da constante. | |
| * @param value {*} valor da constante. | |
| * | |
| */ | |
| function define(name, value) { | |
| Object.defineProperty(window, name, { | |
| value: value, | |
| enumerable: true, | |
| writable: false, | |
| configurable: true | |
| }); | |
| } | |
| //Example: | |
| define('EULER', 2.718281828459045235360287); | |
| console.log(EULER); |
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
| //Criando constantes no ECMAScript 6. | |
| const EULER = 2.718281828459045235360287; | |
| console.log(EULER); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment