Modules and Namespaces
Nested Namespace
Use a nested namespace for a smaller group of operations.
Nested Namespace
nested_namespace.js
const base = 3;
const label = {
math: {
double(value) {
return value * 2;
},
},
}.math.double(base);
console.log("base=" + base);
console.log("label=" + label);
nested-namespace
Nested namespaces can separate groups inside a larger API. Keep the hierarchy small so the call path remains easy to read.