Skip to content

Instantly share code, notes, and snippets.

@variousauthors
Created October 7, 2013 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save variousauthors/6867013 to your computer and use it in GitHub Desktop.
Save variousauthors/6867013 to your computer and use it in GitHub Desktop.
This is the only way I could find to namespace a group of methods in an object.
var obj = (function (){
var self = {
foo: function () {
return 'foo';
},
namespace: {
bar: function () {
return self.foo();
}
}
}
return self;
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment