代码示例:(标识:eg_js_strict_global)
<!DOCTYPE html>
<html>
<body>

<h1>全局 "use strict" 声明</h1>

<p>在浏览器中激活调试(F12)以查看错误报告。</p>

<script>
"use strict";
myFunction();

function myFunction() {
  y = 3.14;   // 会引发错误(y 未定义)
}
</script>

</body>
</html>
运行结果: