es6-destructuring Flashcards

1
Q

What is destructuring, conceptually?

A

assign properties of an object to variables, breaking down an object into pieces

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the syntax for Object destructuring?

A

let { property1: variable1, property2: variable2 } = object;
if you want them to have the same name you can just do the property name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the syntax for Array destructuring?

A

let [x, y, z] = array;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you tell the difference between destructuring and creating Object/Array literals?

A

syntax is reversed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly