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

417option.immed

Expand Messages
  • Douglas Crockford
    Mar 24, 2009
    • 0 Attachment
      I have added a new immed option. When it is true, immediate function invocations must be wrapped in parens. So

      foo = function () {} (); // warning
      foo = (function () {})(); // warning
      foo = (function () {}()); // ok

      A function literal should not be wrapped in parens.

      foo = (function () {}); // warning
      foo = function () {}; // ok

      I am adding this option because I have observed many cases of struggling with the difference between functions as values and the values of functions. I think that the use of parens can signal more clearly the programmer's intention. This convention will allow JSLint to do a better job.

      This convention is new to me. I will be adapting my own code and materials to comply.