妙味——JS的一个重要特性
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Document</title> <script> // var a=1; // alert(a); // function show(){ // alert('a'); // } // window.show(); // var a=12;
alert(a);
alert(window.a);
//用一个不存在的变量的时候:出错 //用一个不存在的属性的时候:undefined </script> </head> <body> </body> </html>
用一个不存在的变量的时候:出错
用一个不存在的属性的时候:undefined
高否?富否?帅否?
否?
滚去学习!