I'm trying to figure out whether the definition of 'use strict' extends to the prototype methods of the constructor. Example:
var MyNamespace = MyNamespace || {};
MyNamespace.Page = function() {
"use strict";
};
MyNamespace.Page.prototype = {
fetch : function() {
// do I need to use "use strict" here again?
}
};
According to Mozilla you can use it as:
function strict(){
"use strict";
function nested() { return "And so am I!"; }
return "Hi! I'm a strict mode function! " + nested();
}
Does it mean that prototype methods inherit strict mode from the constructor?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…