<! DOCTYPE html>//1 ==================================================== varA;if(' A 'inchwindow) { varA = 10; } alert (a); //Ten//Note: In is a keyword used to determine whether the ' property ' in object's current property is an object's property//2 ==================================================== varFoo = 1; functionBar () {if(!foo) { varFoo = 10; } alert (foo); //Ten//Pre-parsing phase://var foo;//Code Execution phase: if(!foo) {Foo= 10; } alert (foo); } bar (); //code splitting://Pre-parsing phase: varfoo;functionBar () {}//Code Execution phase:Foo = 1; bar (); //3 ============================================================ varnum = 123; functionF1 (num) {//var num = 456;Console.log (num);//456 } functionF2 () {varnum = 456; F1 (num);//F1 (456)} f2 (); //4 ===================================================================== functionfn () {varA = 1, b = 1, c = 1;//var a = 1;//var b = 1;//var c = 1;} fn (); Console.log (c); //1 EConsole.log (b);//1 EConsole.log (a);//e e functionfn1 () {varA = b = c = 1; varA = 1; b= 1; C= 1; } FN1 (); Console.log (c); //1Console.log (b);//1Console.log (a);//e //5 ================================================================ varA;functionA () {Console.log (Oh) functionA () {a= 4; Console.log (haha)} a (); Console.log (a); //4} A (); Console.log (a); //outside of a //6 =================================================================== varA = 1; functionA () {a++; } Console.log (a)//1 //7 ===================================================================== varA = {X:1 } varb =A; a.x= A = {N:1}; Console.log (a.x); //undefinedConsole.log (b.x);//{N:1}</script></body>JavaScript Lexical scope Classic Exercises