js函数中变量的作用域
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 2 "http://www.w3.org/TR/html4/loose.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 <title>New Web Project</title> 7 <script type="text/javascript"> 8 function fun() 9 { 10 11 var a=10;//局部变量 显示声明 12 b=20;//全局变量 隐式声明 13 } 14 fun(); 15 //console.log("a="+a); 16 console.log("b="+b); 17 </script> 18 </head> 19 <body> 20 <h1>New Web Project Page</h1> 21 </body> 22 </html>