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

Re: [jslint] Proposal for jslint functionality

Expand Messages
  • Douglas Crockford
    ... JSLint allows void 0 as a transitional convenience. But if the ES5 option is selected, it will produce a warning. In ES3, undefined is a global variable,
    Message 1 of 9 , Jul 19 11:38 AM
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Joshua Bell <josh@...> wrote:
      >
      > Again, let me promote the use of (void 0).
      >
      > if (value === (void 0)) { ... }
      >
      > In JavaScript, void is a unary operator (void EXPR) that always returns
      > undefined. The expression following the operator is evaluated but ignored.
      > This does not depend on the browser environment (as the "undefined" property
      > of the global object does).


      JSLint allows void 0 as a transitional convenience. But if the ES5 option is selected, it will produce a warning.

      In ES3, undefined is a global variable, so there is an obvious hazard because the value of this important constant can be changed. Despite the obvious hazard, I have never heard of a single instance where this was a real problem.

      In ES5, the hazard is corrected by making undefined a const, as it always should have been.
    Your message has been successfully submitted and would be delivered to recipients shortly.