This article is relatively easy to understand. One is an extension to objects, which is similar to the array extension in ES6. The other is an extension to Promise, which is similar to the Ajax extension in Query. Looking forward to our progress together. You can also follow my wechat public number, snail full stack. 1. Array expansion operator in ES6

Const arr1 = [1, 2, 3] const arr2 = (4 and 6) const arr3 = [arr1,... arr2] / / [6]

2. Clone an object

const obj1 = {
        name:"lilei",
        age:12
      }

const obj2 = {
  work:"teacher"
}
Deep copy const obj3 = {... obj1} // {name:"lilei",age:12} obj1.age = 18 console.log(obj3) // {name:"lilei",age:12}

3. Merge objects: If the attributes are identical, the later attribute value replaces the previous attribute value

const obj1 = { name:"lilei", age:12 } const obj2 = { work:"teacher", age:20 } const obj4 = {... obj1,... obj2} console.log(obj4) // {name:"lilei",age:20,work:"teacher"}

4, residual operator: when used as an argument, must be placed last, otherwise an error will be reported

const obj1 = { name:"lilei", age:34, work:"teacher", course:"es" } const {name,age,... rest} = obj1 console.log(name) // lilei console.log(name) // 34 console.log(rest) // { work:"teacher",course:"es"}

2. Promise extension: finally (the content to be executed after asynchronous execution, must be closed after loading interaction and database operation)

new Promise((resolve,reject) => { setTimeout(() => { resolve('success') },1000) }).then(res => { console.log(res) }).catch(err => {console.log(err)}).finally(() => {// complete console.log('finally')}) // Success finally