Re: Undefined variable
> Ah. And now try the same thing, except do an 'alert(d)' in the lastIs execution not an indication of use? I would think if something were properly executed it is used code by the interpreter even if that usage, or any other usage, does not result in any restatement for execution in remaining logic.
> line. See what I mean? Both (function)s are executed, of course, but
> that's not the point. The point is that the *variables* d and z are
> never used.
Furthermore when function d from the example is alerted it returns undefined only because it returns nothing after it executes. This is equivalent to declaring a variable and not defining it. If a return and a quoted string are placed between the end of d and z then d alerts as a value. This is no indication that d is unused.
> Variable z is in fact unused. The proof of that is that you canWhen I execute the program I am presented with a first alert displaying "9" and then a second alert displaying "6". If I remove z from the program the first alert will no longer be present, which is an alteration to the resultant execution even if all other code cannot see or feel that alteration.
> delete "var z = " from that program and the result will be exactly
> the same.
This lack of connection implies that functions of immediate invocation contained as instantiation declarations within other objects have a special unique context until such functions are any way restated or reused outside their declaration. That special unique context would be largely meaningless if not for objects that contain closures and several immediate invocation functions as declarations using those closures after the closure variables are declared.