Umfasst "use strict" im Konstruktor auch Prototypmethoden?
Ich versuche herauszufinden, ob sich die Definition von 'use strict' auf die Prototypmethoden des Konstruktors erstreckt. Beispiel:
var MyNamespace = MyNamespace || {};
MyNamespace.Page = function() {
"use strict";
};
MyNamespace.Page.prototype = {
fetch : function() {
// do I need to use "use strict" here again?
}
};
GemäßMozilla Sie können es verwenden als:
function strict(){
"use strict";
function nested() { return "And so am I!"; }
return "Hi! I'm a strict mode function! " + nested();
}
Bedeutet dies, dass Prototypmethoden den strikten Modus vom Konstruktor erben?