Created
July 27, 2011 15:11
-
-
Save jpcody/1109577 to your computer and use it in GitHub Desktop.
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
//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