"Destructuring allows you to bind a set of variables to a corresponding set of values anywhere that you can normally bind a value to a single variable" ("Common Lisp the Language").
Questions tagged [destructuring]
1338 questions
-4
votes
1 answer
Destructing assignment to swap the values in ES6
I am revising JavaScript and came to following ES6 example.
let a = 8, b = 6;
// change code below this line
[a,b] = [b,a];
// change code above this line
console.log(a); // a is 6
console.log(b); // b is 8
Not able to figure out how this is…

Amol Patil
- 985
- 2
- 11
- 43
-5
votes
1 answer
Javascript accessing nested properties of an object literal
I did my best not to post a duplicate topic by doing a full search on Stack including some of the suggested Similar Questions on right side panel of this page but could not find a decent post that could help me. Here is a partial list of my search…

Jules Manson
- 214
- 2
- 13
-6
votes
1 answer
What does an object destructuring pattern used as the rest property of an array destructuring pattern stand for?
The MDN Web Docs have this example:
Using a binding pattern as the rest property
The rest property of array destructuring assignment can be another array or object binding pattern. This allows you to simultaneously unpack the properties and indices…

Géry Ogam
- 6,336
- 4
- 38
- 67