对于我的 Web 应用程序,我正在 JavaScript 中创建一个命名空间,如下所示:
var com = {example: {}};
com.example.func1 = function(args) { ... }
com.example.func2 = function(args) { ... }
com.example.func3 = function(args) { ... }
我还想创建“私有”(我知道这在 JS 中不存在)命名空间变量,但不确定使用的最佳设计模式是什么。
可不可能是:
com.example._var1 = null;
或者设计模式会是别的东西吗?