Skip to content

Namespaces

Example: App.Utils.Math

  • Organizes code within large projects.
  • Avoids naming collisions.
  • Very common in Java, C#, and even JS (before ES6 modules).
const App = {
Utils: {
sum: (a, b) => a + b
}
};
console.log(App.Utils.sum(2, 3));

Advantages: well-structured code. Disadvantage: verbose, replaced in JS by import/export.