⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.07 - constants.js

📁 JS设计模式源代码
💻 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 + -