记录-Execution Context(Global)

Execution Context--执行上下文

Global Object:

The global execution context creates two things for you.

It create a Global Object and a special variable for you , called "this".

Remember an object is just a collection of name value pairs.

test.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js</title>
    
</head>
<body>
    
</body>
<script src="./test.js"></script>
</html>

test.js

var a = "yibo"; // 全局变量

let b = "baby";  // 非全局变量

function f1 () {
    console.log("test")
}

 

 this:

Outer Environment

Setup Memory Space for Variables and Functions --Hoisting

posted on 2022-06-03 14:05  法老的微笑  阅读(32)  评论(0)    收藏  举报