Skip to content

Instantly share code, notes, and snippets.

@jpcody
Created July 27, 2011 15:11
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 jpcody/1109577 to your computer and use it in GitHub Desktop.
Save jpcody/1109577 to your computer and use it in GitHub Desktop.
//used to have
var someObjOld = {
int1 : {},
int2 : {},
int3 : { function(){ this.int4(); }},
int4 : {}
};
// now have
var someObj = {
int1 : {
int2 : {
int3 : function(){ this.int4(); }
}
},
int4 : {}
};
// want to call
someObj.int1.int2.int3();
// possible solutions
1. use .bind to assign this in the anonymous function in int3 to someObj
2. use a hard-coded reference to someObj
3. is there another way?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment