2

これについていくつか検索しましたが、正確なものは見つかりませんでした。次の例を検討してください。

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?
}

または --> シナリオ 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 が "関数のみの使用を推奨する理由

4

0 に答える 0