Question 7
Back to Exercise
Variables a and b already exist. Which statement assigns obj.a and obj.b to them?
- A { a, b } = obj;
- B ({ a, b } = obj); Correct
- C let { a, b } = obj;
- D [a, b] = obj;
Correct Answer: Option B
Without parentheses the leading { starts a block, which is a SyntaxError. let would redeclare the variables, and an array pattern needs an iterable.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!