es6-destructuring Flashcards
1
Q
What is destructuring, conceptually?
A
Unpack values from arrays, or properties from objects, into distinct variables.
2
Q
What is the syntax for Object destructuring?
A
- Let/Const/Var keyword;
- Opening curly brace;
- Properties storing the variables;
- Closing curly brace;
- Assignment operator
- Object name.
3
Q
What is the syntax for Array destructuring?
A
- Let/Const/Var keyword;
- Opening square brace;
- Name of the variables;
- Closing square brace;
- Assignment operator
- Array name.
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.