2
我最近開始爲我的腳本使用"use strict"
。我注意到的一個行爲就是這個。 [name of variable]
不適用於對象。例如:使用「嚴格使用」和變量範圍
(function(){
"use strict";
window.person = {}
person.name = {
first: "first name",
last: this.first
}
}());
看起來像嚴格的js不允許它了。爲什麼這個被刪除?有什麼缺點嗎?
你期望'this.first'返回什麼? – Andrew
[在JavaScript中做什麼「嚴格使用」)(http://stackoverflow.com/q/1335851/2666313) – mdesdev