添加“使用严格”;一个功能块影响后来添加到原型的方法和属性?

时间:2014-08-21 17:27:14

标签: javascript use-strict

进行了一些搜索并没有找到任何确切的内容。请考虑以下示例:

function ConstructIt (param) {
    "use strict";
    // Set up the object
}

我的问题涉及以下每种情况:

场景1:在与上面相同的文件中,我们有以下代码:

ConstructIt.prototype.methodOne = function (fudgeFactor) {
    // Is this still going to be in strict mode due to having it in the constructor above?
    // Or must I include it here as well?
}

OR - >场景2:在单独的文件中,与场景1相同的代码(可以在构造函数之前或之后出现,显然:

ConstructIt.prototype.methodOne = function (fudgeFactor) {
    // Is this still going to be in strict mode due to having it in the constructor above?
    // Or must I include it here as well?
}

简而言之,我想要了解的是“使用严格”;影响代码,在哪里。另一个好问题:为什么JShint建议仅使用“功能

0 个答案:

没有答案