SHARE
TWEET

Untitled

a guest Jul 21st, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ```let name = 'zhangsan';
  2. name = 'lisi'; //let声明的变量可以重新被赋值
  3. const age= 21;//不可以被重新赋值
  4.  
  5.  let const 生命的变量都是block作用域
  6.         { //block 作用域
  7.             const num =1;
  8.             {
  9.                 alert(num);
  10.             }
  11.             {
  12.                 let num2 = 2;
  13.             }
  14.               alert(num2);
  15.         }
  16.          语法错误 未定义
  17.          
  18.         if(true){
  19.              let num =1;
  20.              
  21.         }
  22.         alert(num);//报错
  23.         //let const var 多使用前两个
  24.  
  25. ```
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top