SOURCE

//测试1
for(let i = 0; i < 10; i++){
    console.log(i);
}
console.log(i)

console.log("**********");

//测试2
var a = [];
for(var i =0; i < 10; i++){
    a[i] = function(){
        console.log(i)
    }
}
a[6]();

//测试3
var a1 = [];
for(let i = 0; i < 10; i++){            //let声明的变脸只在当前作用于生效
    a1[i] = function(){
        console.log(i);
    }
}
a1[6]()

console.log("**********");

//测试4
console.log(foo);
var foo = 1;

//console.log(foo1);
let foo1 = 1;

console.log("**********");

if(true){
    //TDZ开始
    // tmpl = "abc";
    // console.log(tmpl);

    //TDZ结束
    let tmpl;
    console.log(tmpl);

    tmpl = 123;
    console.log(tmpl);
}

// function bar(x = y,y=2){
//     return[x,y];
// }
// bar();
function bar(x = 2, y = x) {
  return [x, y];
}
bar(); // [2, 2]

// let x = x;

console.log("**********");
var data = new Date();
function f(){
    console.log(data);
    if(false){
        var data = "hello world";
    }
}
f()
console 命令行工具 X clear

                    
>
console