JavaScript ES6 Feature Destructuring for "Arrays" and "Objects"

The two most used data structures in JavaScript are Object and Array.

  • Objects allow us to create a single entity that stores data items by key.
  • Arrays allow us to gather data items into an ordered list.

Destructuring  is a special syntax that allows us to “unpack” arrays or objects into a bunch of variables

Destructuring also works great with complex functions that have a lot of parameters, default values, and so on.

Array Destructuring

Example of array Destructuring

Object Destructuring

Object destructuring examples


Thank you sagar ...its very useful info

To view or add a comment, sign in

More articles by Sagar Jadhav

Explore content categories