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

Re: [jslint] option.strict

Expand Messages
  • Douglas Crockford
    ... Yes.
    Message 1 of 9 , Dec 13, 2010
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Rob Richardson" <erobrich@...> wrote:
      >
      > You've specified "at the top of the file" twice. Did you intend to identify
      > the second as "the top of a function"?

      Yes.
    • AJ ONeal
      FYI, at the top of means inside , not on top . That s why I was originally confused. // Non-strict code... (function(){ use strict ; // Define your
      Message 2 of 9 , Dec 13, 2010
      • 0 Attachment
        FYI, "at the top of" means "inside", not "on top".
        That's why I was originally confused.

        // Non-strict code...

        (function(){
        "use strict";

        // Define your library strictly...
        })();

        // Non-strict code...


        http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it


        I believe this would be a useless statement (though I'm not sure).
        In any case it's probably best to avoid it.


        (function(){

        // do stuff
        }());

        "use strict";

        (function(){

        // do stuff
        })();


        AJ ONeal


        On Mon, Dec 13, 2010 at 4:26 PM, Douglas Crockford <douglas@...>wrote:

        >
        >
        > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
        > Richardson" <erobrich@...> wrote:
        > >
        > > You've specified "at the top of the file" twice. Did you intend to
        > identify
        > > the second as "the top of a function"?
        >
        > Yes.
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Jakob Kruse
        In your second example, use strict ; is neither at the top of a file or at the top of a function, thus it has no effect. /Jakob _____ From: AJ ONeal
        Message 3 of 9 , Dec 14, 2010
        • 0 Attachment
          In your second example, "use strict"; is neither at the top of a file or at the top of a function, thus it has no effect.


          /Jakob

          _____

          From: AJ ONeal [mailto:coolaj86@...]
          To: jslint_com@yahoogroups.com
          Sent: Tue, 14 Dec 2010 00:36:05 +0100
          Subject: Re: [jslint] option.strict

          FYI, "at the top of" means "inside", not "on top".
          That's why I was originally confused.

          // Non-strict code...

          (function(){
          "use strict";

          // Define your library strictly...
          })();

          // Non-strict code...


          http://stackoverflow.com/questions/1335851/what-does-use-strict-do-in-javascript-and-what-is-the-reasoning-behind-it


          I believe this would be a useless statement (though I'm not sure).
          In any case it's probably best to avoid it.


          (function(){

          // do stuff
          }());

          "use strict";

          (function(){

          // do stuff
          })();


          AJ ONeal


          On Mon, Dec 13, 2010 at 4:26 PM, Douglas Crockford <douglas@...>wrote:

          >
          >
          > --- In jslint_com@yahoogroups.com <jslint_com%40yahoogroups.com>, "Rob
          > Richardson" <erobrich@...> wrote:
          > >
          > > You've specified "at the top of the file" twice. Did you intend to
          > identify
          > > the second as "the top of a function"?
          >
          > Yes.
          >
          >
          >


          [Non-text portions of this message have been removed]



          ------------------------------------

          Yahoo! Groups Links





          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.