Created
January 24, 2012 21:06
-
-
Save roundcorners/1672703 to your computer and use it in GitHub Desktop.
Namespacing with a object literal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level namespace | |
var MyNamespace = {}; | |
// Adding properties to my namespace | |
MyNamespace.application = {}; | |
// OR | |
MyNamespace.['application'] = {}; | |
// Adding a method to my namespace | |
MyNamespace.application.myFunc = function (a) { | |
.... | |
return a; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment