eg:
func = (){
var i_want_this = "yes";
var callback = function(){
// I want to access value of i_want_this here
// Preferably just the single variable without the whole scope
};
obj.subfunc(some_stuff, callback);
};
obj = {
subfunc = function(stuff, callback){
// do stuff
callback();
}
};
func();
You can use the variable in the callback; it will work the way you want it to.
This is called a closure.