Say I have a code-snippet:
dict = {"key":"elem"} for (var elem in dict){ someFunction(function(){ anotherFunction(dict[elem]); }) } Is elem still that temporary variable created in the for...in... statement when it is referenced at that third level, i.e. at anotherFunction(dict[elem])?
When it gets called in my code, I get an error saying that it returns undefined.
EDIT: could I somehow fix this with a this keyword somewhere?
dictvariable? Object or Array?elem-- what does this imply about the value it evaluates to at the usage site? (Hint: only new function scopes can introduce a new variables.) Look for "javascript loop last value closure" or similar.thissomewhre?dict = {"key" : "val"}