在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在侧栏中.