In ES6
var can be used as a global declaration
Let can be a partial declaration
Const definition constant, no further modification, or error
Array Deconstruction:
let [a,b,c]=[1,2,3];
Pay attention to the same structure and position
Allows a default value of
There are different times when the value is undefined and null
Undefined, the memory is not value, so will go to the default value
NULL, the memory is value, and is displayed as null
Object structure:
Let {a,b}={a: ' Ten ', B: ' 20 '} Note that the object key is not in the corresponding position, it is the corresponding key
Easy Error Point:
When a key to an object has been declared before, it needs to be wrapped or it will be an error.
let c;{c}={c:‘123‘};console.log(c)VM185:2 Uncaught SyntaxError: Unexpected token =let c;({c}={c:‘123‘});console.log(c)VM186:3 123
String structure, (in fact, the string is treated as an array)
const [a,b,c,d,e]="asdfg"
es6-array, object, string deconstruction