Loading ...
Sorry, an error occurred while loading the content.

568Re: Undefined variable

Expand Messages
  • sandyhead25
    Jun 1, 2009
      > Ah. And now try the same thing, except do an 'alert(d)' in the last
      > 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.

      Is 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.

      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.
    • Show all 25 messages in this topic