Namespace in JavaScript
A container which lets developers bundle all functionality under a unique, application-specific name. Creating a namespace in JavaScript is simple, create one global object, and all variables, methods, and functions become properties of that object.
Use of namespaces also reduces the chance of name conflicts in an application,since each application's objects are properties of an application-defined global object.
// global namespace var MYAPP = MYAPP || {};
//creating Sub namespace MYAPP.event = {};
Naming namespace,you'll capitalize the first letter. If your app requires use of global scope, it's good practice to use a namespace like this to prevent name conflicts (just as jQuery uses $ as a namespace in order to access all the methods and properties of its API).
var myApplication = { getInfo:function(){ /* function definition */ }, models : {
}, views : { pages : {} }, collections : { } };
For get to know more about Namespace patterns click here















