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

conversion to string

Expand Messages
  • Joe
    Hi All, I have started getting jslint errors for the following: var stuff = 123; var stuffStr = 123 + ; I get : Error: Problem at line 2 character 22:
    Message 1 of 4 , May 3, 2011
    • 0 Attachment
      Hi All,

      I have started getting jslint errors for the following:

      var stuff = 123;
      var stuffStr = 123 + "";

      I get :
      Error:
      Problem at line 2 character 22: Expected 'String' and instead saw ''''.

      var stuffStr = 123 + "";

      This seems like relatively new behavior, is it on purpose or a jslint parsing bug?
    • Merlin
      ... It is relatively new behavior and it is on purpose. The recommended usage is: var stuff = 123; var stuffStr = String(stuff); Harry.
      Message 2 of 4 , May 3, 2011
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "Joe" <josephjoaquinmartin@...> wrote:
        > I have started getting jslint errors for the following:
        >
        > var stuff = 123;
        > var stuffStr = 123 + "";

        > Error:
        > Problem at line 2 character 22: Expected 'String' and instead saw ''''.
        > var stuffStr = 123 + "";
        >
        > This seems like relatively new behavior, is it on purpose or a jslint parsing bug?

        It is relatively new behavior and it is on purpose.

        The recommended usage is:

        var stuff = 123;
        var stuffStr = String(stuff);

        Harry.
      • Joe
        ... Is there a switch to turn this check off?
        Message 3 of 4 , May 3, 2011
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Merlin" <g7awz@...> wrote:
          >
          >
          >
          > --- In jslint_com@yahoogroups.com, "Joe" <josephjoaquinmartin@> wrote:
          > > I have started getting jslint errors for the following:
          > >
          > > var stuff = 123;
          > > var stuffStr = 123 + "";
          >
          > > Error:
          > > Problem at line 2 character 22: Expected 'String' and instead saw ''''.
          > > var stuffStr = 123 + "";
          > >
          > > This seems like relatively new behavior, is it on purpose or a jslint parsing bug?
          >
          > It is relatively new behavior and it is on purpose.
          >
          > The recommended usage is:
          >
          > var stuff = 123;
          > var stuffStr = String(stuff);
          >
          > Harry.
          >

          Is there a switch to turn this check off?
        • Merlin
          ... No.
          Message 4 of 4 , May 3, 2011
          • 0 Attachment
            --- In jslint_com@yahoogroups.com, "Joe" <joe.martin@...> wrote:
            > Is there a switch to turn this check off?

            No.
          Your message has been successfully submitted and would be delivered to recipients shortly.