Es6-destructuring Flashcards
1
Q
What is destructuring conceptually?
A
A neat way of assigning values, objects or arrays to variables.
2
Q
What is the syntax for Object destructuring?
A
let { property1, property2 } = object; property one becomes a variable with the value within the object. console.log(property1)
3
Q
What is the syntax for Array destructuring?
A
let [
arrayIndex0,
arrayIndex1
] = array;
4
Q
How can you tell the difference between destructuring and creating Object/Array literals?
A
The pattern of creating new variables, Object/Array is extracting data from existing Object/Array.