相关疑难解决方法(0)

使用严格模式时无法检查范围变量

在Safari中运行以下脚本时(打开Inspector)

window.onload = function() { 
    "use strict";
    var x = 1;
    debugger; // debugger will auto-break on this line
}
Run Code Online (Sandbox Code Playgroud)

x在断点上时,在控制台中询问时出现以下错误:

Error
message: "'with' statements are not valid in strict mode"
Run Code Online (Sandbox Code Playgroud)

删除该"use strict";行允许我x在该断点处从控制台访问.

两次都x显示Scope Variables在侧栏中.

javascript safari web-inspector

14
推荐指数
1
解决办法
2239
查看次数

标签 统计

javascript ×1

safari ×1

web-inspector ×1