这段代码的ReferenceError在谷歌Chrome,但不是在Firefox(浏览器错误?)
eval(`
let a = 0;
function f() {}
function g() { a; }
console.log(f);
`);
在Firefox 48.0正常工作,而在谷歌浏览器52.0.2743.116造成Uncaught ReferenceError: f is not defined
(64-位)。
如果
eval
不使用它也能正常工作的谷歌浏览器,或- 内
eval
代码是围绕与{}
,或 a
在g
没有被引用,或let
更改为var
或- 在代码之前添加
这里发生了什么?
根据[MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/let#Browser_compatibility),自Chrome 49.0起,马虎模式支持'let'。 – johnchen902
啊...我正在使用v47 ... – strah