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

Unexpected '('

Expand Messages
  • junkernaught
    This code gives me an error, I m not sure why: function charAt(sValue, index) { return sValue.charAt(index) - 0 ; } Message: Problem at line 2 character 25:
    Message 1 of 3 , Feb 17, 2012
    • 0 Attachment
      This code gives me an error, I'm not sure why:

      function charAt(sValue, index) {
      return sValue.charAt(index) - '0';
      }

      Message:
      Problem at line 2 character 25: Unexpected '('.

      Changing the code to this works fine:

      function charAt(sValue, index) {
      return sValue.charAt(index);
      }
    • douglascrockford
      ... That warning wasn t very helpful. Please try it now.
      Message 2 of 3 , Feb 17, 2012
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "junkernaught" <camomilk@...> wrote:
        >
        > This code gives me an error, I'm not sure why:
        >
        > function charAt(sValue, index) {
        > return sValue.charAt(index) - '0';
        > }
        >
        > Message:
        > Problem at line 2 character 25: Unexpected '('.
        >
        > Changing the code to this works fine:
        >
        > function charAt(sValue, index) {
        > return sValue.charAt(index);
        > }

        That warning wasn't very helpful. Please try it now.
      • junkernaught
        OK, the new warning makes more sense. Thank you!
        Message 3 of 3 , Feb 17, 2012
        • 0 Attachment
          OK, the new warning makes more sense. Thank you!

          --- In jslint_com@yahoogroups.com, "douglascrockford" <douglas@...> wrote:
          >
          > --- In jslint_com@yahoogroups.com, "junkernaught" <camomilk@> wrote:
          > >
          > > This code gives me an error, I'm not sure why:
          > >
          > > function charAt(sValue, index) {
          > > return sValue.charAt(index) - '0';
          > > }
          > >
          > > Message:
          > > Problem at line 2 character 25: Unexpected '('.
          > >
          > > Changing the code to this works fine:
          > >
          > > function charAt(sValue, index) {
          > > return sValue.charAt(index);
          > > }
          >
          > That warning wasn't very helpful. Please try it now.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.