Table of contents
1、let
Different from var, after let declares a variable name, it cannot declare the variable name again.
There is no variable promotion in let, that is, the declaration of the variable must occur before the use of the variable.
let declarations have block-level scope
2、const
Const declares constants whose values cannot be changed, use uppercase letters;
3. Destructuring assignment
variable structure
const F4 = ['小Shenyang','Liu Neng','Zhao Si','Song Xiaobao']
let [xiao, liu, zhao, song] = F4
object structure
const a = {
name : 'a',
age: 18,
b : function(){
console.log('haha')
}
}
let {name,age,b} = a
4. Template string
Wrap the string in backticks
5. Object copy
use' ... '
let person1 = { name:"a",age:17 }
let person2 = { ...person1 }
That is, the copy of person1 is completed.
6. Arrow function
Parameter => function body
function(){} becomes () => {}
If the method body has only one line, you can omit {}
7、Promise
Promise is a new solution for asynchronous programming introduced in ES6. Syntactically, Promise is a constructor, used to encapsulate asynchronous operations and obtain their success or failure results.