1 <script type="text/javascript"> 2 function f(a){ 3 console.log(a);// function 4 var a = 2; 5 console.log(a);// 2 6 function a(){}; 7 console.log(a);// 2 8 } 9 f(1); 10 11 //上述函数预解析的过程如下: 12 function f(a){ 13 var a = function(){}; 14 console.log(a); 15 // function 16 var a = 2; 17 console.log(a); 18 //2 19 console.log(a); 20 //2 21 } 22 f(1); 23 24 </script>