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

JSLint: Expected an assignment or function call

Expand Messages
  • Re Miya
    In jQuery there is the following code when throwing error in an Ajax call: function (XMLHttpRequest, textStatus, errorThrown) { // typically only one of
    Message 1 of 3 , May 20, 2008
    View Source
    • 0 Attachment
      In jQuery there is the following code when throwing error in an Ajax call:

      function (XMLHttpRequest, textStatus, errorThrown) {
      // typically only one of textStatus or errorThrown
      // will have info
      this; // the options for this ajax request
      }

      JSLint throws the following error:

      Problem at line 4 character 3: Expected an assignment or function call
      and instead saw an expression.

      this;

      How can this issue be resolved?
    • Douglas Crockford
      Clearly that code is bad. How you fix it depends on what it is supposed to do. If you delete the line containing this; it will behave as it does now.
      Message 2 of 3 , May 20, 2008
      View Source
      • 0 Attachment
        Clearly that code is bad. How you fix it depends on what it is supposed to do.
        If you delete the line containing

        this;

        it will behave as it does now.

        Re Miya wrote:
        > In jQuery there is the following code when throwing error in an Ajax call:
        >
        > function (XMLHttpRequest, textStatus, errorThrown) {
        > // typically only one of textStatus or errorThrown
        > // will have info
        > this; // the options for this ajax request
        > }
        >
        > JSLint throws the following error:
        >
        > Problem at line 4 character 3: Expected an assignment or function call
        > and instead saw an expression.
        >
        > this;
        >
        > How can this issue be resolved?
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
      • Re Miya
        I do not know what *this;* is intended to do. But because this is placed in the jQuery website official documentation for Ajax, I thought it might be some kind
        Message 3 of 3 , May 20, 2008
        View Source
        • 0 Attachment
          I do not know what *this;* is intended to do. But because this is
          placed in the jQuery website official documentation for Ajax, I
          thought it might be some kind of cross-browser issue. Otherwise I see
          no reason for *this;*

          --- In jslint_com@yahoogroups.com, Douglas Crockford <douglas@...> wrote:
          >
          > Clearly that code is bad. How you fix it depends on what it is
          supposed to do.
          > If you delete the line containing
          >
          > this;
          >
          > it will behave as it does now.
          >
          > Re Miya wrote:
          > > In jQuery there is the following code when throwing error in an
          Ajax call:
          > >
          > > function (XMLHttpRequest, textStatus, errorThrown) {
          > > // typically only one of textStatus or errorThrown
          > > // will have info
          > > this; // the options for this ajax request
          > > }
          > >
          > > JSLint throws the following error:
          > >
          > > Problem at line 4 character 3: Expected an assignment or function call
          > > and instead saw an expression.
          > >
          > > this;
          > >
          > > How can this issue be resolved?
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.