E
ed
Question about the following example code:
var something = {
classMemberObjRef : null,
randomOperation : function() {
var localObjRef = something.classMemberObjRef;
...
}
secondOperation : function() {
var localObjRef = something.classMemberObjRef;
...
}
}
I've seen this a few times, and am not sure what the need is to create
localObjRef for each function. Is this a simply a best practice, or is
there something else to it? Is there some sort of scoping issue that
will prevent direct access to something.classMemeberObjRef? Will it
vary per-function? Just looking for some info I can't find in my books....
var something = {
classMemberObjRef : null,
randomOperation : function() {
var localObjRef = something.classMemberObjRef;
...
}
secondOperation : function() {
var localObjRef = something.classMemberObjRef;
...
}
}
I've seen this a few times, and am not sure what the need is to create
localObjRef for each function. Is this a simply a best practice, or is
there something else to it? Is there some sort of scoping issue that
will prevent direct access to something.classMemeberObjRef? Will it
vary per-function? Just looking for some info I can't find in my books....