📄 3.07 - constants.js
字号:
var Class = (function() { // Constants (created as private static attributes). var UPPER_BOUND = 100; // Privileged static method. this.getUPPER_BOUND() { return UPPER_BOUND; } ... // Return the constructor. return function(constructorArgument) { ... }})();/* Grouping constants together. */var Class = (function() { // Private static attributes. var constants = { UPPER_BOUND: 100, LOWER_BOUND: -100 } // Privileged static method. this.getConstant(name) { return constants[name]; } ... // Return the constructor. return function(constructorArgument) { ... }})();/* Usage. */Class.getConstant('UPPER_BOUND');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -