Namespaces

Contents

  1. Overview

Overview

Unlike many object-orientated languages such as C++ and C#, namespaces are not natively supported in JavaScript.

However, they can be “faked” in a number of different ways. One of the easiest is to enclose everything within a variable:

Notice though, you have to remember to include commas after every function or variable declaration. AND, you can’t declare private objects. But it is the simplest solution.