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

Strict mode

Expand Messages
  • roman_lcf
    We want to not add use strict to every our js-file for now, but still take advantage of the strictest JSLint code quality setting. I see strict_mode
    Message 1 of 2 , Jan 10, 2011
    • 0 Attachment
      We want to not add "use strict" to every our js-file for now, but still take advantage of the strictest JSLint code quality setting.
      I see 'strict_mode' variable in JSLint source code, but how to set it? Is able to set it through options?

      Thanks,
      Roman
    • Dominic Mitchell
      ... You can add it on a per-function basis: function foo() { use strict ; // ... } You can also wrap parts of your code in an anonymous function in order to
      Message 2 of 2 , Jan 10, 2011
      • 0 Attachment
        On Mon, Jan 10, 2011 at 2:12 PM, roman_lcf <roman.lcf@...> wrote:

        > We want to not add "use strict" to every our js-file for now, but still
        > take advantage of the strictest JSLint code quality setting.
        > I see 'strict_mode' variable in JSLint source code, but how to set it? Is
        > able to set it through options?
        >
        >
        You can add it on a per-function basis:

        function foo() {
        "use strict";
        // ...
        }

        You can also wrap parts of your code in an anonymous function in order to
        isolate it.

        (function() {
        "use strict";

        function foo() {
        // …
        }
        }());

        -Dom


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