【JavaScript】JS中没有代码块的概念

 1     <script>
 2         
 3         var m = "roboce";
 4         if(m === "roboce"){
 5             var k = "haha";
 6         }
 7         
 8         var a = function() {
 9             var aa = "aa";
10         }
11         
12         function f1() {
13             var bb = "bb";
14         }
15         console.log(k); // haha
16         console.log(aa); // undefined
17         console.log(bb); // undefined
18     </script>

 

你可能感兴趣的:(JavaScript)