destructuring assignment

destructuring assignment

  The destructuring assignment syntax is a JavaScript expression that makes it possible to extract data from arrays or objects into distinct variables.

  

  A variable can be assigned a default, in the case that the value pulled from the array is undefined.

  

  You can ignore return values that you're not interested in:

  

  When destructuring an array, you can assign the remaining part of it to a variable using the rest pattern:

  

  

  Object destructuring

  

  A variable can be assigned its value with destructuring separate from its declaration.

  

  Assigning to new variable names

  

  default values

  

  Nested object and array destructuring

  

  For of iteration and destructuring

  

参考:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment

原文地址:https://www.cnblogs.com/tekkaman/p/6383203.html