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

<h1>JavaScript 函数</h1>

<p>在 HTML 中,全局函数中 <b>this </b> 的值是 window 对象。</p>

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

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

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