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

539Re: [jslint] Re: Undefined variable

Expand Messages
  • Michael Lorton
    May 28, 2009
    • 0 Attachment
      > you might try something like this...


      > var Testvar = window.Testvar || {};


      Not exactly like that, because

      window.Testvar = 0;
      var Testvar = window.Testvar || {};

      Would result in Testvar being set to {}, not 0 as you would presumably want. Maybe

      var Testvar = (window.Testvar === undefined) || {};


      M.

      --- In jslint_com@yahoogroups.com, Nagy Endre <forewer2000@...> wrote:
      >
      > I'm trying to check if a variable is already defined and define if is not.
      >
      > If (Testvar === undefined) {
      > � var Testvar = {};
      > }
      >
      > JsLint say that Testvar was used before was defined.
      > How can I check this in the right way?
      >
      >
      >
      >
      >
      >
      > [Non-text portions of this message have been removed]
      >




      ------------------------------------

      Yahoo! Groups Links



      [Non-text portions of this message have been removed]
    • Show all 25 messages in this topic