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

Suggestion for error

Expand Messages
  • Luke Page
    if (a !== a) { } if (a === a) { } I ve just debugged a piece of code where someone a long time ago thought they were adding a check to see if the argument they
    Message 1 of 2 , Feb 2, 2011
    • 0 Attachment
      if (a !== a) {
      }

      if (a === a) {
      }

      I've just debugged a piece of code where someone a long time ago thought
      they were adding a check to see if the argument they had been passed was
      equal to a field - but had mis-typed or mis-copy and pasted. It took a while
      to find it because when I looked at the code I saw what the writer had
      intended, not what was actually written. So the code should have been

      if (a !== this.a) {
      // perform change
      }

      I can't think when

      if (a !== a) {
      }

      or

      if (a === a) {
      }

      would be valid...


      [Non-text portions of this message have been removed]
    • Douglas Crockford
      ... Good idea. Please try it now.
      Message 2 of 2 , Feb 2, 2011
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, Luke Page <luke.a.page@...> wrote:
        > if (a !== a) {
        > }
        >
        > if (a === a) {
        > }
        >
        > I've just debugged a piece of code where someone a long time ago thought
        > they were adding a check to see if the argument they had been passed was
        > equal to a field - but had mis-typed or mis-copy and pasted. It took a while
        > to find it because when I looked at the code I saw what the writer had
        > intended, not what was actually written. So the code should have been
        >
        > if (a !== this.a) {
        > // perform change
        > }
        >
        > I can't think when
        >
        > if (a !== a) {
        > }
        >
        > or
        >
        > if (a === a) {
        > }
        >
        > would be valid...

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