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

2944[jslint] Re: How to add expection for "Use '===' to compare directly with undefined." error

Expand Messages
  • douglascrockford
    Jul 25, 2012
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Jordan Harband <ljharb@...> wrote:

      > I found http://jsperf.com/typeof-vs-undefined-check/3 awhile back which shows that `typeof foo === "undefined"` is faster in some browsers and slower in others.

      I do not recommend selecting programming features based on insignificant performance findings.

      > Given that "undefined" can be redefined in older browsers, what reasons remain for warning on checking undefined with typeof? The only other thing you've implied is that people don't redefine undefined. Obviously you may pick whichever defaults you like. Since it's possible to redefined undefined, however, would you please add a "tolerate" option for this? It would be appreciated.

      Such a mishaps has never been reported. It is fixed in ES5. JSLint does not allow it.
    • Show all 6 messages in this topic