Example 1: Here in this example we declared two variables a and b unassigned and an array with two strings “First” and “Second” int it. On line 5 we used destructuring assignment to assign values of array to and b respectively.
a: First b: Second
As you can see variable a has string “First” assigned and variable b has string “Second” assigned.
Example 2: Here we declared two variables a and b having values “First” and “Second” respectively. In the next line we swapped variables using destructuring assignment.
a: Second b: First