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.

Posted: December 6th, 2015 at 11:21 am
Last Updated on: December 6th, 2015 at 8:33 pm