568Re: Undefined variable
- Jun 1, 2009
> 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.
- << Previous post in topic Next post in topic >>