Some Questions about function scope and pre-resolution, function Scope Analysis
These are some questions about function scopes and pre-resolution./* Function foo1 () {return {bar: "hello", he: "hehe"
};} Alert (foo1 (); */about the return pit/* function foo1 () {return {bar: "hello"} alert (foo1 ()); */------------------------------/* (function () {var a = B = 3 ;}) (); // console. log (a); console. log (B); console. log ("a defined? "+ (Typeof! = 'Undefined'); console. log ("B defined? "+ (Typeof B! = 'Undefined'); */-------------------------------/* var a = 10; function test () {a = 100; alert (a); alert (window. a); var a; alert (a); return ;}
Test (); alert (a); */----------------------------/* function test () {console. log (a); console. log (foo (); var a = 1; function foo () {return 2 ;}} test (); */----------------------------/* var a = 10; sayHi (); function sayHi () {a = a + 10; alert (a); return a;} alert (a); alert (sayHi () + 10 ); */good case/* var a = 10; sayHi (); function sayHi () {var a = a + 10; alert (a); return ;} alert (a); alert (sayHi () + 10) */-----------------------------/* var s = 'abc12345'; var num = parseInt (s); if (num = NaN) {alert ('nan ');} else if (typeof num = 'number') {alert ('number');} else if (num = 'abc ') {alert ('abc');} else {alert ('str ');}*/