Defining a Namespace

JavaScript doesn't support private variables natively as yet. There are ways to create pseudo-private variables, but the problem is that they can still be overwritten by other developers (by mistake or on purpose).

  • Create an anonymous function
  • Self-trigger an anonymous function
  • Create private variables