Lets say I have an ajax call like this:
$.ajax({
...
success : someFn
})
On the code review, they asked about what environment does someFn
have access to? They were more worried about, what all variables, scopes does someFn
have access to and how I'm going to manage the changes that are done in someFn
.
For example if :
someFn : function()
{
//1. changes some object value
//2. Works based on some scope variables
}
Now the question is:
- How I can send the scope variables to
someFn
and reason about them? - If the scope variables is an reference to another object, how should I handle those changes within
someFn
.
Thanks in advance