0

我正在尝试将D3嵌入到项目中,但由于“使用我的环境中的“严格”指令(出于好奇,这是您开发 Firefox 附加组件时默认发生的事情)。我忽略了这个问题有一个简单的解决方法吗?我不能不使用严格的空间,因为开发环境正在为我这样做,显然,我无法阻止它。

4

1 回答 1

2

永远不要将“use strict”语句放在全局范围内,而只能放在单个函数中:

//non strict function doing non strict stuff
function a(){
    return arguments.callee;
}

//strict function calling non strict function
function b() {
    "use strict";
    a();
}

//no error
b();
于 2013-07-11T11:21:19.723 回答