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

Re: Test for space.

Expand Messages
  • Douglas Crockford
    ... Thanks. Please try it now.
    Message 1 of 6 , Aug 8, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Harry Whitfield <g7awz@...> wrote:
      >
      > var x = "fred";
      > if (x == " ") { // the string is a single space, not the empty string
      > alert("x is a space");
      > }
      >
      > results in this error message:
      >
      > Error:
      > Problem at line 2 character 7: Use '===' to compare with ' '.
      >
      > if (x == " ") {

      Thanks. Please try it now.
    • Harry Whitfield
      ... Fixed - Thanks. (x == ) now gives error message again (which is correct). Harry.
      Message 2 of 6 , Aug 8, 2010
      • 0 Attachment
        On 8 Aug 2010, at 21:27:17, Douglas Crockford wrote:

        > --- In jslint_com@yahoogroups.com, Harry Whitfield <g7awz@...> wrote:
        > >
        > > var x = "fred";
        > > if (x == " ") { // the string is a single space, not the empty string
        > > alert("x is a space");
        > > }
        > >
        > > results in this error message:
        > >
        > > Error:
        > > Problem at line 2 character 7: Use '===' to compare with ' '.
        > >
        > > if (x == " ") {
        >
        > Thanks. Please try it now.

        Fixed - Thanks.

        (x == "") now gives error message again (which is correct).

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