How To: Javascript Namespacing

Skip Navigation LinksIrocon > Blog > 2008 > March, 2008 > March 30, 2008 > How To: Javascript Namespacing

How To: Javascript Namespacing

Creating namespaces for javascript on web applications is a very uncommon approach. However, in a world where the possiblity of clashes between variable and function names is very high, especially among scripts from different sources, it becomes important to understand this neat and elegant concept by Dustin Diaz.

Basically the steps that make this possible are as follows:

  • Create the Namespace Object as a function literal
  • self-invoke the function
  • return methods and properties

 

Last Updated:Thursday, September 02, 2010By:alferoSource#

Would you like to comment?

Sign in with your OpenID. If you do not know what OpenID is, find out.