ES6 let and const

and let const

let

A. 1 = the let ; 
the console.log (B); 
var B =. 1 ;
 / *  
    var: 
        1. repeat statements 
        2. Scope: global scope function scope 
        3. the Analytical -> below the above statement executed undefined 
    the let: 
        not redeclaration 1. under the same scope 
        2. scope: global scope and block-level scope {} -> braces 
        3. without the analytical 
 * /

 const: Constant

ARR. 1 = const ; 
the console.log (ARR); 
// declare that assignment, the back can not be modified 
/ *  
1. Under the same scope not redeclaration 
2. Scope: global scope and block-level scope { } -> braces 
3. without the analytical 
 * /

 

Guess you like

Origin www.cnblogs.com/Afanadmin/p/12340056.html