Are there any dangers associated with using JavaScript namespaces?
问题 Are there any dangers/caveats one should be aware of when creating JavaScript namespaces? Our project is fairly expansive and we are running a lot of JavaScript files (20+, expecting more). It is impossible to have any code maintainability without using namespaces, so we are implementing them like so: var namespace1 = { doSomething: function() { ... }, doSomethingElse: function() { ... } } And then to create hierarchies, we link them like so: var globalNamespace = { functions1: namespace1,