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

Re: [jslint] JSLint, unary +, and array subscripts

Expand Messages
  • Jakob Kruse
    Might I suggest that you try rewriting your code so that when read, it makes sense. Maybe then JSLint will stop complaining? /Jakob _____ From: Josh Jordan
    Message 1 of 4 , Sep 18, 2012
    • 0 Attachment
      Might I suggest that you try rewriting your code so that when read, it makes sense. Maybe then JSLint will stop complaining?


      /Jakob

      _____

      From: Josh Jordan [mailto:therealjoshjordan@...]
      To: jslint_com@yahoogroups.com
      Sent: Tue, 18 Sep 2012 13:41:20 +0200
      Subject: [jslint] JSLint, unary +, and array subscripts






      I expect jslint to accept the following two-line code snippet, but
      instead it gives the error "Unexpected '['". What am I doing wrong?

      ===JSLINT INPUT===
      var a = ["1"], b;
      b = +a[0];

      ===JSLINT OUTPUT===
      Unexpected '['. (line 2, character 7)
      b = +a[0];



      [Non-text portions of this message have been removed]
    • Luke Page
      b = +a[0]; b = Number(a[0]); OR b = a[0]; ... [Non-text portions of this message have been removed]
      Message 2 of 4 , Sep 18, 2012
      • 0 Attachment
        b = +a[0];

        b = Number(a[0]);
        OR
        b = a[0];

        On 18 September 2012 12:41, Josh Jordan <therealjoshjordan@...> wrote:

        > **
        >
        >
        > I expect jslint to accept the following two-line code snippet, but
        > instead it gives the error "Unexpected '['". What am I doing wrong?
        >
        > ===JSLINT INPUT===
        > var a = ["1"], b;
        > b = +a[0];
        >
        > ===JSLINT OUTPUT===
        > Unexpected '['. (line 2, character 7)
        > b = +a[0];
        >
        >


        [Non-text portions of this message have been removed]
      • douglascrockford
        ... Thanks. Please try it now.
        Message 3 of 4 , Sep 18, 2012
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, Josh Jordan <therealjoshjordan@...> wrote:
          >
          > I expect jslint to accept the following two-line code snippet, but
          > instead it gives the error "Unexpected '['". What am I doing wrong?
          >
          > ===JSLINT INPUT===
          > var a = ["1"], b;
          > b = +a[0];
          >
          > ===JSLINT OUTPUT===
          > Unexpected '['. (line 2, character 7)
          > b = +a[0];


          Thanks. Please try it now.
        Your message has been successfully submitted and would be delivered to recipients shortly.