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

Re: var a = b = "c"; Stopping, unable to continue

Expand Messages
  • Douglas Crockford
    ... That form is confusing because many people expect that b is also declared, but it is not, so b becomes a global variable. To disambiguate, write it as var
    Message 1 of 2 , Mar 23, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "marc_hunter" <yahoo@...> wrote:
      >
      > Just came across some code which was overriding some functionality from the jquery datepicker. The code uses this construct:
      >
      > var a = b = c;
      >
      > which happens to gum up the jslint parser.

      That form is confusing because many people expect that b is also declared, but it is not, so b becomes a global variable. To disambiguate, write it as

      var a = (b = c);
    Your message has been successfully submitted and would be delivered to recipients shortly.