Object methods of rest and spread

// the object into a plurality of objects in 
const INPUT = { 
  A: . 1 , 
  B: 2 
} 
const Test = { 
  D: . 5 
} 
const Output = { 
  ... INPUT, 
  ... Test, 
  C: . 3 
} 

/ / dismantling the object, obtaining the desired properties 
const INPUT = { 
  a: . 1 , 
  B: 2 , 
  C: . 3 , 
  D: . 4 , 
  E: . 5 
} 
const {a, B, ...} REST = INPUT 
the console.log (a, b, rest)

 

Guess you like

Origin www.cnblogs.com/qjb2404/p/12231668.html