严格模式中函数内 this 为 undefined:
var hasStrictMode = (function () {
"use strict";
return this == undefined;
})();
另外,一个忽略 new 操作符的技巧:
function P() {
if (!(this instanceof P)) return new P();
} 严格模式中函数内 this 为 undefined:
var hasStrictMode = (function () {
"use strict";
return this == undefined;
})();
另外,一个忽略 new 操作符的技巧:
function P() {
if (!(this instanceof P)) return new P();
}