Are there any dangers / caveats to be aware of when creating JavaScript namespaces?
Our project is quite expansive, and we run many JavaScript files (20+, expecting more). It is not possible to maintain code compatibility without using namespaces, so we implement them like this:
var namespace1 = {
doSomething: function() {
...
},
doSomethingElse: function() {
...
}
}
Then, to create hierarchies, we link them like this:
var globalNamespace = {
functions1: namespace1,
functions2: namespace2,
...
}
, "", JS , . , , , , , - . JS-, . , .
- , "" ? ?