The destructuring assignment

The destructuring assignment is an expression that allows you to assign the values or properties of an iterable or object, to the variables, using a syntax that looks similar to the array or object construction literals respectively.

A destructuring assignment makes it easy to extract data from iterables or objects by providing a shorter syntax. A destructuring assignment is already present in the programming languages, such as Perl and Python, and works the same way everywhere.

There are two kinds of destructuring assignment expressions—the array and object destructuring assignment. Let's see each of them in details.

The array destructuring assignment

An array destructuring assignment is used to extract the values of ...

Get React: Building Modern Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.