123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- /*
- let 和 var的区别
- 1.let 不能重复声明
- 2.let 没有变量提升
- 3.临时失效区 在这区域内 不允许同名的变量出现
- 4.let 具有块级作用域
- */
- // var a = 13;
- // let a = 10;
- // let b = 20;
- // a = 30;
- // b = 40;
- // console.log(a,b)
- // var a = 10;
- // var a = 20
- // console.log(a)
- /* let a = 10; */
- /* let a = 20 */
- /* console.log(a) */
- // let a = 10
- // function fn() {
- // let a = 'abc'
- // console.log(a)
-
- // }
- // fn()
- // console.log(a)
- var a = true;
- if(a){
- let x = 100
- }
- console.log(x)
- </script>
- </body>
- </html>
|