ES6 Destructuring Flashcards
1
Q
What is destructuring, conceptually?
A
taking values out of an object/array and assigning them to a variable
2
Q
What is the syntax for Object destructuring?
A
const { property: var1, property2: Var2, …etc ) = Object. (if the var and title match you can do: const {property, property2, …. etc) = object.
3
Q
What is the syntax for Array destructuring?
A
const [var 1, var2, var 3,…. etc] = Array
4
Q
How can you tell the difference between destructuring and creating Object/Array literals?
A
Arrays have [], Objects have {};