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

[jslint] Re: typeof null

Expand Messages
  • spence.randall@ymail.com
    Right, typof null was never a question, that one is pretty well known to be problematic. I was more curious about typeof undefined. So typeof undefined is
    Message 1 of 10 , Jul 23 10:17 AM
    • 0 Attachment
      Right, typof null was never a question, that one is pretty well known to be problematic. I was more curious about typeof undefined.

      So typeof undefined is bigger and slower and less informative, that I can understand, but what do you recommend to guard against someone assigning to undefined? Use our own local variable? That also seems to me like it would be less informative.

      Thanks,
      Randall

      --- In jslint_com@yahoogroups.com, Joe Hansche <madcoder@...> wrote:
      >
      > On Jul 23, 2012 12:57 PM, "douglascrockford" <douglas@...> wrote:
      > >
      > >
      > >
      > > --- In jslint_com@yahoogroups.com, "spence.randall@" <randall@>
      > wrote:
      > > >
      > > > I'd like to hear from Douglas as to why the change and warning, we
      > still don't know the reason for the change, so perhaps there is something
      > we are missing.
      > >
      > > typeof null is an error.
      >
      > To clarify: see
      > https://developer.mozilla.org/en/JavaScript/Reference/Operators/typeof#null
      >
      > typeof null returns "object", which is counter productive, and will become
      > inconsistent in future versions of ECMAScript.
      >
      > > typeof undefined is bigger and slower and less informative.
      > >
      > >
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • douglascrockford
      ... Let me know when that happens.
      Message 2 of 10 , Jul 23 11:09 AM
      • 0 Attachment
        --- In jslint_com@yahoogroups.com, "spence.randall@..." <randall@...> wrote:
        >
        > Right, typof null was never a question, that one is pretty well known to be problematic. I was more curious about typeof undefined.
        >
        > So typeof undefined is bigger and slower and less informative, that I can understand, but what do you recommend to guard against someone assigning to undefined? Use our own local variable? That also seems to me like it would be less informative.


        Let me know when that happens.
      Your message has been successfully submitted and would be delivered to recipients shortly.