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

<h1>JavaScript <b>this</b> 关键词</h1>

<p>在函数中,默认地,<b>this</b> 引用全局对象。</p>

<p>在严格模式中,<b>this</b> 是 <b>undefined</b>,因为严格模式不允许默认绑定:</p>

<p id="demo"></p>

<script>
"use strict";
document.getElementById("demo").innerHTML = myFunction();
function myFunction() {
  return this;
}
</script>

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