进行了一些搜索并没有找到任何确切的内容。请考虑以下示例:
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建议仅使用“功能