【发布时间】:2012-05-07 02:02:27
【问题描述】:
我最近开始在我的脚本中使用"use strict"。我注意到的一种行为是 this.[name of variable] 不适用于对象。例如:
(function(){
"use strict";
window.person = {}
person.name = {
first: "first name",
last: this.first
}
}());
似乎严格的 js 不再允许了。为什么要删除这个?有什么缺点吗?
【问题讨论】:
-
你期望
this.first会返回什么?
标签: javascript scope strict