为什么这段代码很好:
var test = {
fn1: function(_origin, _componentType) {
if(arguments.length > 1) throw "xx";
// this strict is ok
"use strict";
var interface = new Object(this);
}
}
虽然这不是
var test = {
fn1: function(_origin, _componentType) {
// This strict throws SyntaxError
"use strict";
if(arguments.length > 1) throw "xx";
var interface = new Object(this);
}
}
我知道 interface 在严格模式下是保留字,但是两个示例都不应该抛出错误吗?