Announcement

Collapse
No announcement yet.

What is destructuring assignment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What is destructuring assignment

    What is destructuring assignment



    The destructuring assignment is a JavaScript expression that makes it possible to unpack values from arrays or properties from objects into distinct variables. Let's get the month values from an array using destructuring assignment

    Code:
    var [one, two, three] = ['JAN', 'FEB', 'MARCH'];
    
    console.log(one); // "JAN"
    console.log(two); // "FEB"
    console.log(three); // "MARCH"

Related Topics

Collapse

Working...
X