es6-destructuring Flashcards

1
Q

What is destructuring, conceptually?

A

Unpack values from arrays, or properties from objects, into distinct variables.

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
  1. Let/Const/Var keyword;
  2. Opening curly brace;
  3. Properties storing the variables;
  4. Closing curly brace;
  5. Assignment operator
  6. Object 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
  1. Let/Const/Var keyword;
  2. Opening square brace;
  3. Name of the variables;
  4. Closing square brace;
  5. Assignment operator
  6. Array name.
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

The assignment operator is before the curly/square braces for creating and after for destructuring.

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