aaaa
This commit is contained in:
155
teaching/wanzhaoyi/yubianyi.html
Normal file
155
teaching/wanzhaoyi/yubianyi.html
Normal file
@@ -0,0 +1,155 @@
|
||||
<!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>Document</title>
|
||||
<script>
|
||||
// var a=1
|
||||
// function fn(e){
|
||||
// var b=1
|
||||
// c=0
|
||||
// var a="l"
|
||||
// console.log(window.a)
|
||||
// }
|
||||
// fn("a")
|
||||
// console.log(e)
|
||||
// console.log(c)
|
||||
// console.log(b)
|
||||
// a 全局变量 全局作用域
|
||||
// b 局部变量(局部作用域)
|
||||
|
||||
// GO{
|
||||
// a:undefined,
|
||||
// fn:function(){}
|
||||
// }
|
||||
// AO{
|
||||
// b:undefined,
|
||||
// c:undefined,
|
||||
// a:undefined,
|
||||
// e:undefined
|
||||
// }
|
||||
// AO{
|
||||
// b:undefined,
|
||||
// c:undefined,
|
||||
// a:undefined,
|
||||
// e:"a"
|
||||
// }
|
||||
// AO{
|
||||
// b:undefined,
|
||||
// c:undefined,
|
||||
// a:undefined,
|
||||
// e:"a"
|
||||
// }
|
||||
|
||||
// js 运行三部曲:语法分析 预编译 解释执行
|
||||
// function fn1(){
|
||||
// console.log(a) //window.a
|
||||
// var a=1 //window.a
|
||||
// // console.log(a)
|
||||
// }
|
||||
// fn1()
|
||||
|
||||
|
||||
//AO{}
|
||||
//AO{
|
||||
// a:undefined==> 1
|
||||
// }
|
||||
|
||||
// GO{
|
||||
// fn:function
|
||||
// }
|
||||
|
||||
|
||||
// 预编译
|
||||
// 1.分为 全局(GO)和局部 (AO)
|
||||
// 2.发生什么(AO)
|
||||
// 1. 创建AO对象
|
||||
// 2. 去找形参 变量声明 =>undefined
|
||||
// 3. 形参实参相统一
|
||||
// 4. 找函数声明 值赋予函数体
|
||||
|
||||
|
||||
|
||||
// function fn(a) {
|
||||
// console.log(a); function a() { }
|
||||
|
||||
// var a = 666;
|
||||
|
||||
// console.log(a); 666
|
||||
|
||||
// function a() { }
|
||||
|
||||
// console.log(a); 666
|
||||
|
||||
// var b = function () { };
|
||||
|
||||
// console.log(b); function() { }
|
||||
|
||||
// function c() { }
|
||||
// }
|
||||
|
||||
// fn(1);
|
||||
|
||||
// AO{}
|
||||
// AO{
|
||||
// a:undefined,
|
||||
// b:undefined,
|
||||
// }
|
||||
// AO{
|
||||
// a:1,
|
||||
// b:undefined,
|
||||
// }
|
||||
// AO{
|
||||
// a:Function,
|
||||
// b:undefined,
|
||||
// c:function
|
||||
// }
|
||||
|
||||
|
||||
var a = 1;
|
||||
console.log(a);
|
||||
function test(a) {
|
||||
console.log(a);
|
||||
var a = 123;
|
||||
console.log(a);
|
||||
function a() { }
|
||||
console.log(a);
|
||||
var b = function () { }
|
||||
console.log(b);
|
||||
function d() { }
|
||||
}
|
||||
var c = function () {
|
||||
console.log("I at C function");
|
||||
}
|
||||
console.log(c);
|
||||
test(2);
|
||||
// AO{}
|
||||
// AO{
|
||||
// a:undefined,
|
||||
// b:undefined,
|
||||
// c:undefined
|
||||
// }
|
||||
// AO{
|
||||
// a:2,
|
||||
// b:undefined,
|
||||
// c:undefined
|
||||
|
||||
// }
|
||||
// AO{
|
||||
// a:function,
|
||||
// d:function,
|
||||
// b:undefined,
|
||||
// c:undefined
|
||||
// }
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user